Added changeDevelopmentMode & getAnalyticsDashboard to Zones (#32)
* Added toggleDevelopmentMode to Zones * Improved success checking Added PHPUnit test (I think?) * Fixed success checking * Fixed test * Ran PHP CS Fixer * Added getAnalyticsDashboard to Zones Renamed toggleDevelopmentMode to changeDevelopmentMode to be uniform * Fixed test (hopefully) * Trying it a different way * Another attempt * Lol I guess we are just supressing errors for this one?
This commit is contained in:
@@ -109,6 +109,43 @@ class Zones implements API
|
||||
return $zones->result[0]->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
|
||||
*
|
||||
* @param string $zoneID
|
||||
* @param string $since
|
||||
* @param string $until
|
||||
* @param bool $continuous
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getAnalyticsDashboard(string $zoneID, string $since = "-10080", string $until = "0", bool $continuous = true): \stdClass
|
||||
{
|
||||
$response = $this->adapter->get('zones/' . $zoneID . '/analytics/dashboard', [], ["since" => $since, "until" => $until, "continuous" => $continuous]);
|
||||
|
||||
return json_decode($response->getBody())->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
|
||||
*
|
||||
* @param string $zoneID
|
||||
* @param bool $enable
|
||||
* @return bool
|
||||
*/
|
||||
public function changeDevelopmentMode(string $zoneID, bool $enable = false): bool
|
||||
{
|
||||
$response = $this->adapter->patch('zones/' . $zoneID . '/settings/development_mode', [], ["value" => ($enable ? "on" : "off")]);
|
||||
|
||||
$body = json_decode($response->getBody());
|
||||
|
||||
if ($body->success) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Purge Everything
|
||||
* @param string $zoneID
|
||||
|
||||
Reference in New Issue
Block a user