add php docs for methods

This commit is contained in:
Michael Markoski
2019-05-21 16:20:56 -05:00
parent b46a2f80f5
commit b81c67ddc5
2 changed files with 46 additions and 33 deletions

View File

@@ -25,11 +25,9 @@ class Crypto implements API
'zones/' . $zoneID . '/settings/ssl' 'zones/' . $zoneID . '/settings/ssl'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result->value; return $body->result->value;
} }
return false; return false;
} }
@@ -45,11 +43,9 @@ class Crypto implements API
'zones/' . $zoneID . '/ssl/verification' 'zones/' . $zoneID . '/ssl/verification'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->result) { if ($body->result) {
return $body->result; return $body->result;
} }
return false; return false;
} }
@@ -65,11 +61,9 @@ class Crypto implements API
'zones/' . $zoneID . '/settings/opportunistic_encryption' 'zones/' . $zoneID . '/settings/opportunistic_encryption'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result->value; return $body->result->value;
} }
return false; return false;
} }
@@ -85,11 +79,9 @@ class Crypto implements API
'zones/' . $zoneID . '/settings/opportunistic_onion' 'zones/' . $zoneID . '/settings/opportunistic_onion'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result; return $body->result;
} }
return false; return false;
} }
@@ -99,11 +91,9 @@ class Crypto implements API
'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->value; return $body->result->value;
} }
return false; return false;
} }
@@ -113,11 +103,9 @@ class Crypto implements API
'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->value; return $body->result->value;
} }
return false; return false;
} }
@@ -137,11 +125,9 @@ class Crypto implements API
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
@@ -161,11 +147,9 @@ class Crypto implements API
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
@@ -185,14 +169,19 @@ class Crypto implements API
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
/**
* Update the Oppurtunistic Encryption setting for the zone
*
* @param string $zoneID The ID of the zone
* @param string $value The value of the zone setting
* @return bool
*/
public function updateOpportunisticEncryptionSetting($zoneID, $value) public function updateOpportunisticEncryptionSetting($zoneID, $value)
{ {
$return = $this->adapter->patch( $return = $this->adapter->patch(
@@ -202,14 +191,19 @@ class Crypto implements API
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
/**
* Update the Onion Routing setting for the zone
*
* @param string $zoneID The ID of the zone
* @param string $value The value of the zone setting
* @return bool
*/
public function updateOnionRoutingSetting($zoneID, $value) public function updateOnionRoutingSetting($zoneID, $value)
{ {
$return = $this->adapter->patch( $return = $this->adapter->patch(
@@ -219,11 +213,9 @@ class Crypto implements API
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
} }

View File

@@ -19,20 +19,30 @@ class TLS implements API
$this->adapter = $adapter; $this->adapter = $adapter;
} }
/**
* Get the TLS Client Auth setting for the zone
*
* @param string $zoneID The ID of the zone
* @return string|false
*/
public function getTLSClientAuth($zoneID) public function getTLSClientAuth($zoneID)
{ {
$return = $this->adapter->get( $return = $this->adapter->get(
'zones/' . $zoneID . '/settings/tls_client_auth' 'zones/' . $zoneID . '/settings/tls_client_auth'
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return $body->result->value; return $body->result->value;
} }
return false; return false;
} }
/**
* Enable TLS 1.3 for the zone
*
* @param string $zoneID The ID of the zone
* @return bool
*/
public function enableTLS13($zoneID) public function enableTLS13($zoneID)
{ {
$return = $this->adapter->patch( $return = $this->adapter->patch(
@@ -40,14 +50,18 @@ class TLS implements API
['value' => 'on'] ['value' => 'on']
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
/**
* Disable TLS 1.3 for the zone
*
* @param string $zoneID The ID of the zone
* @return bool
*/
public function disableTLS13($zoneID) public function disableTLS13($zoneID)
{ {
$return = $this->adapter->patch( $return = $this->adapter->patch(
@@ -55,15 +69,19 @@ class TLS implements API
['value' => 'off'] ['value' => 'off']
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
/**
* Update the minimum TLS version setting for the zone
*
* @param string $zoneID The ID of the zone
* @param string $minimumVersion The version to update to
* @return bool
*/
public function changeMinimumTLSVersion($zoneID, $minimumVersion) public function changeMinimumTLSVersion($zoneID, $minimumVersion)
{ {
$return = $this->adapter->patch( $return = $this->adapter->patch(
@@ -73,14 +91,19 @@ class TLS implements API
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }
/**
* Update the TLS Client Auth setting for the zone
*
* @param string $zoneID The ID of the zone
* @param string $value The value of the zone setting
* @return bool
*/
public function updateTLSClientAuth($zoneID, $value) public function updateTLSClientAuth($zoneID, $value)
{ {
$return = $this->adapter->patch( $return = $this->adapter->patch(
@@ -90,11 +113,9 @@ class TLS implements API
] ]
); );
$body = json_decode($return->getBody()); $body = json_decode($return->getBody());
if ($body->success) { if ($body->success) {
return true; return true;
} }
return false; return false;
} }