Remove unnecessary double quotes
This commit is contained in:
@@ -21,7 +21,7 @@ class Guzzle implements Adapter
|
||||
public function __construct(Auth $auth, String $baseURI = null)
|
||||
{
|
||||
if ($baseURI === null) {
|
||||
$baseURI = "https://api.cloudflare.com/client/v4/";
|
||||
$baseURI = 'https://api.cloudflare.com/client/v4/';
|
||||
}
|
||||
|
||||
$headers = $auth->getHeaders();
|
||||
@@ -128,7 +128,7 @@ class Guzzle implements Adapter
|
||||
}
|
||||
|
||||
if (isset($json->success) && ($json->success === false)) {
|
||||
throw new ResponseException("Request was unsuccessful.");
|
||||
throw new ResponseException('Request was unsuccessful.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,28 +14,28 @@ class PageRulesActions implements Configurations
|
||||
|
||||
public function setAlwaysOnline(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("always_online", [
|
||||
$this->addConfigurationOption('always_online', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setAlwaysUseHTTPS(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("always_use_https", [
|
||||
$this->addConfigurationOption('always_use_https', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setBrowserCacheTTL(int $ttl)
|
||||
{
|
||||
$this->addConfigurationOption("browser_cache_ttl", [
|
||||
$this->addConfigurationOption('browser_cache_ttl', [
|
||||
'value' => $ttl
|
||||
]);
|
||||
}
|
||||
|
||||
public function setBrowserIntegrityCheck(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("browser_check", [
|
||||
$this->addConfigurationOption('browser_check', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
@@ -43,35 +43,35 @@ class PageRulesActions implements Configurations
|
||||
public function setBypassCacheOnCookie(string $value)
|
||||
{
|
||||
if (preg_match('/^([a-zA-Z0-9\.=|_*-]+)$/i', $value) < 1) {
|
||||
throw new ConfigurationsException("Invalid cookie string.");
|
||||
throw new ConfigurationsException('Invalid cookie string.');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("bypass_cache_on_cookie", [
|
||||
$this->addConfigurationOption('bypass_cache_on_cookie', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setCacheByDeviceType(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("cache_by_device_type", [
|
||||
$this->addConfigurationOption('cache_by_device_type', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setCacheKey(string $value)
|
||||
{
|
||||
$this->addConfigurationOption("cache_key", [
|
||||
$this->addConfigurationOption('cache_key', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setCacheLevel(string $value)
|
||||
{
|
||||
if (!in_array($value, ["bypass", "basic", "simplified", "aggressive", "cache_everything"])) {
|
||||
throw new ConfigurationsException("Invalid cache level");
|
||||
if (!in_array($value, ['bypass', 'basic', 'simplified', 'aggressive', 'cache_everything'])) {
|
||||
throw new ConfigurationsException('Invalid cache level');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("cache_level", [
|
||||
$this->addConfigurationOption('cache_level', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
@@ -79,31 +79,31 @@ class PageRulesActions implements Configurations
|
||||
public function setCacheOnCookie(string $value)
|
||||
{
|
||||
if (preg_match('/^([a-zA-Z0-9\.=|_*-]+)$/i', $value) < 1) {
|
||||
throw new ConfigurationsException("Invalid cookie string.");
|
||||
throw new ConfigurationsException('Invalid cookie string.');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("cache_on_cookie", [
|
||||
$this->addConfigurationOption('cache_on_cookie', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setDisableApps(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("disable_apps", [
|
||||
$this->addConfigurationOption('disable_apps', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setDisablePerformance(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("disable_performance", [
|
||||
$this->addConfigurationOption('disable_performance', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setDisableSecurity(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("disable_security", [
|
||||
$this->addConfigurationOption('disable_security', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
@@ -111,17 +111,17 @@ class PageRulesActions implements Configurations
|
||||
public function setEdgeCacheTTL(int $value)
|
||||
{
|
||||
if ($value > 2419200) {
|
||||
throw new ConfigurationsException("Edge Cache TTL too high.");
|
||||
throw new ConfigurationsException('Edge Cache TTL too high.');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("edge_cache_ttl", [
|
||||
$this->addConfigurationOption('edge_cache_ttl', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setEmailObfuscation(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("disable_security", [
|
||||
$this->addConfigurationOption('disable_security', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class PageRulesActions implements Configurations
|
||||
throw new ConfigurationsException('Status Codes can only be 301 or 302.');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("forwarding_url", [
|
||||
$this->addConfigurationOption('forwarding_url', [
|
||||
'status_code' => $statusCode,
|
||||
'url' => $forwardingUrl,
|
||||
]);
|
||||
@@ -140,28 +140,28 @@ class PageRulesActions implements Configurations
|
||||
|
||||
public function setHostHeaderOverride(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("host_header_override", [
|
||||
$this->addConfigurationOption('host_header_override', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setHotlinkProtection(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("hotlink_protection", [
|
||||
$this->addConfigurationOption('hotlink_protection', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setIPGeoLocationHeader(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("ip_geolocation", [
|
||||
$this->addConfigurationOption('ip_geolocation', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setMinification(bool $html, bool $css, bool $javascript)
|
||||
{
|
||||
$this->addConfigurationOption("minification", [
|
||||
$this->addConfigurationOption('minification', [
|
||||
'html' => $this->getBoolAsOnOrOff($html),
|
||||
'css' => $this->getBoolAsOnOrOff($css),
|
||||
'js' => $this->getBoolAsOnOrOff($javascript),
|
||||
@@ -170,124 +170,124 @@ class PageRulesActions implements Configurations
|
||||
|
||||
public function setMirage(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("mirage", [
|
||||
$this->addConfigurationOption('mirage', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setOriginErrorPagePassthru(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("origin_error_page_pass_thru", [
|
||||
$this->addConfigurationOption('origin_error_page_pass_thru', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setQueryStringSort(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("sort_query_string_for_cache", [
|
||||
$this->addConfigurationOption('sort_query_string_for_cache', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setDisableRailgun(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("disable_railgun", [
|
||||
$this->addConfigurationOption('disable_railgun', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setResolveOverride(bool $value)
|
||||
{
|
||||
$this->addConfigurationOption("resolve_override", [
|
||||
$this->addConfigurationOption('resolve_override', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setRespectStrongEtag(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("respect_strong_etag", [
|
||||
$this->addConfigurationOption('respect_strong_etag', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setResponseBuffering(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("response_buffering", [
|
||||
$this->addConfigurationOption('response_buffering', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setRocketLoader(string $value)
|
||||
{
|
||||
if (!in_array($value, ["off", "manual", "automatic"])) {
|
||||
if (!in_array($value, ['off', 'manual', 'automatic'])) {
|
||||
throw new ConfigurationsException('Rocket Loader can only be off, automatic, or manual.');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("rocket_loader", [
|
||||
$this->addConfigurationOption('rocket_loader', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setSecurityLevel(string $value)
|
||||
{
|
||||
if (!in_array($value, ["off", "essentially_off", "low", "medium", "high", "under_attack"])) {
|
||||
if (!in_array($value, ['off', 'essentially_off', 'low', 'medium', 'high', 'under_attack'])) {
|
||||
throw new ConfigurationsException('Can only be set to off, essentially_off, low, medium, high or under_attack.');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("security_level", [
|
||||
$this->addConfigurationOption('security_level', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setServerSideExcludes(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("server_side_exclude", [
|
||||
$this->addConfigurationOption('server_side_exclude', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setSmartErrors(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("smart_errors", [
|
||||
$this->addConfigurationOption('smart_errors', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setSSL(string $value)
|
||||
{
|
||||
if (!in_array($value, ["off", "flexible", "full", "strict", "origin_pull"])) {
|
||||
if (!in_array($value, ['off', 'flexible', 'full', 'strict', 'origin_pull'])) {
|
||||
throw new ConfigurationsException('Can only be set to off, flexible, full, strict, origin_pull.');
|
||||
}
|
||||
|
||||
$this->addConfigurationOption("smart_errors", [
|
||||
$this->addConfigurationOption('smart_errors', [
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
public function setTrueClientIpHeader(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("true_client_ip_header", [
|
||||
$this->addConfigurationOption('true_client_ip_header', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setWAF(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("waf", [
|
||||
$this->addConfigurationOption('waf', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setAutomatedHTTPSRewrites(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("automatic_https_rewrites", [
|
||||
$this->addConfigurationOption('automatic_https_rewrites', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
public function setOpportunisticEncryption(bool $active)
|
||||
{
|
||||
$this->addConfigurationOption("opportunistic_encryption", [
|
||||
$this->addConfigurationOption('opportunistic_encryption', [
|
||||
'value' => $this->getBoolAsOnOrOff($active)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class PageRulesTargets implements Configurations
|
||||
$target = new \stdClass();
|
||||
$target->target = 'url';
|
||||
$target->constraint = new \stdClass();
|
||||
$target->constraint->operator = "matches";
|
||||
$target->constraint->operator = 'matches';
|
||||
$target->constraint->value = $queryUrl;
|
||||
|
||||
$this->targets = [$target];
|
||||
|
||||
@@ -15,7 +15,7 @@ class UARules implements Configurations
|
||||
public function addUA(string $value)
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$object->target = "ua";
|
||||
$object->target = 'ua';
|
||||
$object->value = $value;
|
||||
|
||||
array_push($this->configs, $object);
|
||||
|
||||
@@ -15,7 +15,7 @@ class ZoneLockdown implements Configurations
|
||||
public function addIP(string $value)
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$object->target = "ip";
|
||||
$object->target = 'ip';
|
||||
$object->value = $value;
|
||||
|
||||
array_push($this->configs, $object);
|
||||
@@ -24,7 +24,7 @@ class ZoneLockdown implements Configurations
|
||||
public function addIPRange(string $value)
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$object->target = "ip_range";
|
||||
$object->target = 'ip_range';
|
||||
$object->value = $value;
|
||||
|
||||
array_push($this->configs, $object);
|
||||
|
||||
@@ -62,14 +62,14 @@ class DNS implements API
|
||||
|
||||
public function listRecords(
|
||||
string $zoneID,
|
||||
string $type = "",
|
||||
string $name = "",
|
||||
string $content = "",
|
||||
string $type = '',
|
||||
string $name = '',
|
||||
string $content = '',
|
||||
int $page = 1,
|
||||
int $perPage = 20,
|
||||
string $order = "",
|
||||
string $direction = "",
|
||||
string $match = "all"
|
||||
string $order = '',
|
||||
string $direction = '',
|
||||
string $match = 'all'
|
||||
): \stdClass {
|
||||
$query = [
|
||||
'page' => $page,
|
||||
|
||||
@@ -35,7 +35,7 @@ class Railgun implements API
|
||||
public function list(
|
||||
int $page = 1,
|
||||
int $perPage = 20,
|
||||
string $direction = ""
|
||||
string $direction = ''
|
||||
): \stdClass {
|
||||
$query = [
|
||||
'page' => $page,
|
||||
|
||||
@@ -37,7 +37,7 @@ class User implements API
|
||||
|
||||
public function updateUserDetails(array $details): \stdClass
|
||||
{
|
||||
$response = $this->adapter->patch("user", [], $details);
|
||||
$response = $this->adapter->patch('user', [], $details);
|
||||
return json_decode($response->getBody());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ class WAF implements \Cloudflare\API\Endpoints\API
|
||||
string $zoneID,
|
||||
int $page = 1,
|
||||
int $perPage = 20,
|
||||
string $order = "",
|
||||
string $direction = "",
|
||||
string $match = "all"
|
||||
string $order = '',
|
||||
string $direction = '',
|
||||
string $match = 'all'
|
||||
): \stdClass {
|
||||
$query = [
|
||||
'page' => $page,
|
||||
@@ -67,9 +67,9 @@ class WAF implements \Cloudflare\API\Endpoints\API
|
||||
string $packageID,
|
||||
int $page = 1,
|
||||
int $perPage = 20,
|
||||
string $order = "",
|
||||
string $direction = "",
|
||||
string $match = "all"
|
||||
string $order = '',
|
||||
string $direction = '',
|
||||
string $match = 'all'
|
||||
): \stdClass {
|
||||
$query = [
|
||||
'page' => $page,
|
||||
@@ -134,9 +134,9 @@ class WAF implements \Cloudflare\API\Endpoints\API
|
||||
string $packageID,
|
||||
int $page = 1,
|
||||
int $perPage = 20,
|
||||
string $order = "",
|
||||
string $direction = "",
|
||||
string $match = "all"
|
||||
string $order = '',
|
||||
string $direction = '',
|
||||
string $match = 'all'
|
||||
): \stdClass {
|
||||
$query = [
|
||||
'page' => $page,
|
||||
|
||||
@@ -37,7 +37,7 @@ class Zones implements API
|
||||
if (!empty($organizationID)) {
|
||||
$organization = new \stdClass();
|
||||
$organization->id = $organizationID;
|
||||
$options["organization"] = $organization;
|
||||
$options['organization'] = $organization;
|
||||
}
|
||||
|
||||
$user = $this->adapter->post('zones', [], $options);
|
||||
@@ -58,13 +58,13 @@ class Zones implements API
|
||||
}
|
||||
|
||||
public function listZones(
|
||||
string $name = "",
|
||||
string $status = "",
|
||||
string $name = '',
|
||||
string $status = '',
|
||||
int $page = 1,
|
||||
int $perPage = 20,
|
||||
string $order = "",
|
||||
string $direction = "",
|
||||
string $match = "all"
|
||||
string $order = '',
|
||||
string $direction = '',
|
||||
string $match = 'all'
|
||||
): \stdClass {
|
||||
$query = [
|
||||
'page' => $page,
|
||||
@@ -98,12 +98,12 @@ class Zones implements API
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getZoneID(string $name = ""): string
|
||||
public function getZoneID(string $name = ''): string
|
||||
{
|
||||
$zones = $this->listZones($name);
|
||||
|
||||
if (sizeof($zones->result) < 1) {
|
||||
throw new EndpointException("Could not find zones with specified name.");
|
||||
throw new EndpointException('Could not find zones with specified name.');
|
||||
}
|
||||
|
||||
return $zones->result[0]->id;
|
||||
@@ -118,9 +118,9 @@ class Zones implements API
|
||||
* @param bool $continuous
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getAnalyticsDashboard(string $zoneID, string $since = "-10080", string $until = "0", bool $continuous = true): \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]);
|
||||
$response = $this->adapter->get('zones/' . $zoneID . '/analytics/dashboard', [], ['since' => $since, 'until' => $until, 'continuous' => $continuous]);
|
||||
|
||||
return json_decode($response->getBody())->result;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class Zones implements API
|
||||
*/
|
||||
public function changeDevelopmentMode(string $zoneID, bool $enable = false): bool
|
||||
{
|
||||
$response = $this->adapter->patch('zones/' . $zoneID . '/settings/development_mode', [], ["value" => ($enable ? "on" : "off")]);
|
||||
$response = $this->adapter->patch('zones/' . $zoneID . '/settings/development_mode', [], ['value' => ($enable ? 'on' : 'off')]);
|
||||
|
||||
$body = json_decode($response->getBody());
|
||||
|
||||
@@ -153,7 +153,7 @@ class Zones implements API
|
||||
*/
|
||||
public function cachePurgeEverything(string $zoneID): bool
|
||||
{
|
||||
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', [], ["purge_everything" => true]);
|
||||
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', [], ['purge_everything' => true]);
|
||||
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
@@ -167,7 +167,7 @@ class Zones implements API
|
||||
public function cachePurge(string $zoneID, array $files = null, array $tags = null): bool
|
||||
{
|
||||
if (is_null($files) && is_null($tags)) {
|
||||
throw new EndpointException("No files or tags to purge.");
|
||||
throw new EndpointException('No files or tags to purge.');
|
||||
}
|
||||
|
||||
$options = [
|
||||
|
||||
Reference in New Issue
Block a user