diff --git a/src/Endpoints/TLS.php b/src/Endpoints/TLS.php index 38f0a46..a675b01 100644 --- a/src/Endpoints/TLS.php +++ b/src/Endpoints/TLS.php @@ -25,7 +25,7 @@ class TLS implements API 'zones/' . $zoneID . '/settings/tls_1_3', ['value' => 'on'] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -40,7 +40,7 @@ class TLS implements API 'zones/' . $zoneID . '/settings/tls_1_3', ['value' => 'off'] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -50,16 +50,15 @@ class TLS implements API } - public function changeMinimumTLSVersion($zoneID, $minimumVersion) { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/min_tls_version', [ - 'value' => $minimumVersion + 'value' => $minimumVersion, ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -67,38 +66,44 @@ class TLS implements API return false; } - public function getHTTPSRedirectStatus($zoneID) { + + public function getHTTPSRedirectSetting($zoneID) + { $return = $this->adapter->get( 'zones/' . $zoneID . '/settings/always_use_https' ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { - return $body->result; + return $body->result->value; } return false; } - public function getHTTPSRewritesStatus($zoneID) { + + public function getHTTPSRewritesSetting($zoneID) + { $return = $this->adapter->get( 'zones/' . $zoneID . '/settings/automatic_https_rewrites' ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { - return $body->result; + return $body->result->value; } return false; } - public function updateHTTPSRedirects($zoneID, $value) { + + public function updateHTTPSRedirectStatus($zoneID, $value) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/always_use_https', [ - 'value' => $value + 'value' => $value, ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -106,14 +111,16 @@ class TLS implements API return false; } - public function updateHTTPSRewrites($zoneID, $value) { + + public function updateHTTPSRewritesStatus($zoneID, $value) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/automatic_https_rewrites', [ - 'value' => $value + 'value' => $value, ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; diff --git a/src/Endpoints/ZoneSettings.php b/src/Endpoints/ZoneSettings.php index 7fc9f2f..e8877b7 100644 --- a/src/Endpoints/ZoneSettings.php +++ b/src/Endpoints/ZoneSettings.php @@ -18,75 +18,89 @@ class ZoneSettings implements API { $this->adapter = $adapter; } - public function getMinifySetting($zoneID) { + + public function getMinifySetting($zoneID) + { $return = $this->adapter->get( 'zones/' . $zoneID . '/settings/minify' ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { - return $body->result; + return $body->result->value; } return false; } - public function getRocketLoaderSetting($zoneID) { + + public function getRocketLoaderSetting($zoneID) + { $return = $this->adapter->get( 'zones/' . $zoneID . '/settings/rocket_loader' ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { - return $body->result; + return $body->result->value; } return false; } - public function getAlwaysOnlineSetting($zoneID) { + + public function getAlwaysOnlineSetting($zoneID) + { $return = $this->adapter->get( 'zones/' . $zoneID . '/settings/always_online' ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { - return $body->result; + return $body->result->value; } return false; } - public function getEmailObfuscationSetting($zoneID) { + + public function getEmailObfuscationSetting($zoneID) + { $return = $this->adapter->get( 'zones/' . $zoneID . '/settings/email_obfuscation' ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { - return $body->result; + return $body->result->value; } return false; } - public function getHotlinkProtectionSetting($zoneID) { + + public function getHotlinkProtectionSetting($zoneID) + { $return = $this->adapter->get( 'zones/' . $zoneID . '/settings/hotlink_protection' ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { - return $body->result; + return $body->result->value; } return false; } - public function updateMinifySetting($zoneID, $html, $css, $js) { + + public function updateMinifySetting($zoneID, $html, $css, $js) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/minify', [ - 'html' => $html, - 'css' => $css, - 'js' => $js + 'value' => [ + 'html' => $html, + 'css' => $css, + 'js' => $js, + ], ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -94,13 +108,15 @@ class ZoneSettings implements API return false; } - public function updateRocketLoaderSetting($zoneID, $value) { + + public function updateRocketLoaderSetting($zoneID, $value) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/rocket_loader', [ - 'value' => $value + 'value' => $value, ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -108,13 +124,15 @@ class ZoneSettings implements API return false; } - public function updateAlwaysOnlineSetting($zoneID, $value) { + + public function updateAlwaysOnlineSetting($zoneID, $value) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/always_online', [ - 'value' => $value + 'value' => $value, ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -122,13 +140,15 @@ class ZoneSettings implements API return false; } - public function updateEmailObfuscationSetting($zoneID, $value) { + + public function updateEmailObfuscationSetting($zoneID, $value) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/email_obfuscation', [ - 'value' => $value + 'value' => $value, ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true; @@ -136,13 +156,15 @@ class ZoneSettings implements API return false; } - public function updateHotlinkProtectionSetting($zoneID, $value) { + + public function updateHotlinkProtectionSetting($zoneID, $value) + { $return = $this->adapter->patch( 'zones/' . $zoneID . '/settings/hotlink_protection', [ - 'value' => $value + 'value' => $value, ] ); - $body = json_decode($return->getBody()); + $body = json_decode($return->getBody()); if ($body->success) { return true;