Updated to PSR-2

This commit is contained in:
Paul Adams
2019-02-26 20:06:07 +00:00
parent f105d38d85
commit 9d434a23b3
2 changed files with 78 additions and 49 deletions

View File

@@ -25,7 +25,7 @@ class TLS implements API
'zones/' . $zoneID . '/settings/tls_1_3', 'zones/' . $zoneID . '/settings/tls_1_3',
['value' => 'on'] ['value' => 'on']
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -40,7 +40,7 @@ class TLS implements API
'zones/' . $zoneID . '/settings/tls_1_3', 'zones/' . $zoneID . '/settings/tls_1_3',
['value' => 'off'] ['value' => 'off']
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -50,16 +50,15 @@ class TLS implements API
} }
public function changeMinimumTLSVersion($zoneID, $minimumVersion) public function changeMinimumTLSVersion($zoneID, $minimumVersion)
{ {
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/min_tls_version', 'zones/' . $zoneID . '/settings/min_tls_version',
[ [
'value' => $minimumVersion 'value' => $minimumVersion,
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -67,38 +66,44 @@ class TLS implements API
return false; return false;
} }
public function getHTTPSRedirectStatus($zoneID) {
public function getHTTPSRedirectSetting($zoneID)
{
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/always_use_https' 'zones/' . $zoneID . '/settings/always_use_https'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result->value;
} }
return false; return false;
} }
public function getHTTPSRewritesStatus($zoneID) {
public function getHTTPSRewritesSetting($zoneID)
{
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/automatic_https_rewrites' 'zones/' . $zoneID . '/settings/automatic_https_rewrites'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result->value;
} }
return false; return false;
} }
public function updateHTTPSRedirects($zoneID, $value) {
public function updateHTTPSRedirectStatus($zoneID, $value)
{
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/always_use_https', 'zones/' . $zoneID . '/settings/always_use_https',
[ [
'value' => $value 'value' => $value,
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -106,14 +111,16 @@ class TLS implements API
return false; return false;
} }
public function updateHTTPSRewrites($zoneID, $value) {
public function updateHTTPSRewritesStatus($zoneID, $value)
{
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/automatic_https_rewrites', 'zones/' . $zoneID . '/settings/automatic_https_rewrites',
[ [
'value' => $value 'value' => $value,
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;

View File

@@ -18,75 +18,89 @@ class ZoneSettings implements API
{ {
$this->adapter = $adapter; $this->adapter = $adapter;
} }
public function getMinifySetting($zoneID) {
public function getMinifySetting($zoneID)
{
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/minify' 'zones/' . $zoneID . '/settings/minify'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result->value;
} }
return false; return false;
} }
public function getRocketLoaderSetting($zoneID) {
public function getRocketLoaderSetting($zoneID)
{
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/rocket_loader' 'zones/' . $zoneID . '/settings/rocket_loader'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result->value;
} }
return false; return false;
} }
public function getAlwaysOnlineSetting($zoneID) {
public function getAlwaysOnlineSetting($zoneID)
{
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/always_online' 'zones/' . $zoneID . '/settings/always_online'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result->value;
} }
return false; return false;
} }
public function getEmailObfuscationSetting($zoneID) {
public function getEmailObfuscationSetting($zoneID)
{
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/email_obfuscation' 'zones/' . $zoneID . '/settings/email_obfuscation'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result->value;
} }
return false; return false;
} }
public function getHotlinkProtectionSetting($zoneID) {
public function getHotlinkProtectionSetting($zoneID)
{
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/hotlink_protection' 'zones/' . $zoneID . '/settings/hotlink_protection'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result->value;
} }
return false; return false;
} }
public function updateMinifySetting($zoneID, $html, $css, $js) {
public function updateMinifySetting($zoneID, $html, $css, $js)
{
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/minify', [ 'zones/' . $zoneID . '/settings/minify', [
'html' => $html, 'value' => [
'css' => $css, 'html' => $html,
'js' => $js 'css' => $css,
'js' => $js,
],
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -94,13 +108,15 @@ class ZoneSettings implements API
return false; return false;
} }
public function updateRocketLoaderSetting($zoneID, $value) {
public function updateRocketLoaderSetting($zoneID, $value)
{
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/rocket_loader', [ 'zones/' . $zoneID . '/settings/rocket_loader', [
'value' => $value 'value' => $value,
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -108,13 +124,15 @@ class ZoneSettings implements API
return false; return false;
} }
public function updateAlwaysOnlineSetting($zoneID, $value) {
public function updateAlwaysOnlineSetting($zoneID, $value)
{
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/always_online', [ 'zones/' . $zoneID . '/settings/always_online', [
'value' => $value 'value' => $value,
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -122,13 +140,15 @@ class ZoneSettings implements API
return false; return false;
} }
public function updateEmailObfuscationSetting($zoneID, $value) {
public function updateEmailObfuscationSetting($zoneID, $value)
{
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/email_obfuscation', [ 'zones/' . $zoneID . '/settings/email_obfuscation', [
'value' => $value 'value' => $value,
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
@@ -136,13 +156,15 @@ class ZoneSettings implements API
return false; return false;
} }
public function updateHotlinkProtectionSetting($zoneID, $value) {
public function updateHotlinkProtectionSetting($zoneID, $value)
{
$return = $this->adapter->patch( $return = $this->adapter->patch(
'zones/' . $zoneID . '/settings/hotlink_protection', [ 'zones/' . $zoneID . '/settings/hotlink_protection', [
'value' => $value 'value' => $value,
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;