Switch from stdClass to object casting
This commit is contained in:
@@ -14,13 +14,15 @@ class PageRulesTargets implements Configurations
|
||||
|
||||
public function __construct(string $queryUrl)
|
||||
{
|
||||
$target = new \stdClass();
|
||||
$target->target = 'url';
|
||||
$target->constraint = new \stdClass();
|
||||
$target->constraint->operator = 'matches';
|
||||
$target->constraint->value = $queryUrl;
|
||||
|
||||
$this->targets = [$target];
|
||||
$this->targets = [
|
||||
(object)[
|
||||
'target' => 'url',
|
||||
'constraint' => (object)[
|
||||
'operator' => 'matches',
|
||||
'value' => $queryUrl
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getArray(): array
|
||||
|
||||
@@ -14,9 +14,7 @@ class UARules implements Configurations
|
||||
|
||||
public function addUA(string $value)
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$object->target = 'ua';
|
||||
$object->value = $value;
|
||||
$object = (object)['target' => 'ua', 'value' => $value];
|
||||
|
||||
array_push($this->configs, $object);
|
||||
}
|
||||
|
||||
@@ -14,18 +14,14 @@ class ZoneLockdown implements Configurations
|
||||
|
||||
public function addIP(string $value)
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$object->target = 'ip';
|
||||
$object->value = $value;
|
||||
$object = (object)['target' => 'ip', 'value' => $value];
|
||||
|
||||
array_push($this->configs, $object);
|
||||
}
|
||||
|
||||
public function addIPRange(string $value)
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$object->target = 'ip_range';
|
||||
$object->value = $value;
|
||||
$object = (object)['target' => 'ip_range', 'value' => $value];
|
||||
|
||||
array_push($this->configs, $object);
|
||||
}
|
||||
|
||||
@@ -100,11 +100,7 @@ class DNS implements API
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/dns_records', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function getRecordDetails(string $zoneID, string $recordID): \stdClass
|
||||
|
||||
@@ -49,11 +49,7 @@ class Railgun implements API
|
||||
$user = $this->adapter->get('railguns', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function get(
|
||||
@@ -71,11 +67,7 @@ class Railgun implements API
|
||||
$user = $this->adapter->get('railguns/' . $railgunID . '/zones', [], []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function update(
|
||||
|
||||
@@ -33,11 +33,7 @@ class UARules implements API
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/ua_rules', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function createRule(
|
||||
|
||||
@@ -44,11 +44,7 @@ class WAF implements API
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +83,7 @@ class WAF implements API
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/waf/packages/' . $packageID . '/rules', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function getRuleInfo(
|
||||
@@ -159,11 +151,7 @@ class WAF implements API
|
||||
);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function getGroupInfo(
|
||||
|
||||
@@ -32,11 +32,7 @@ class ZoneLockdown implements API
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function createLockdown(
|
||||
|
||||
@@ -35,9 +35,7 @@ class Zones implements API
|
||||
];
|
||||
|
||||
if (!empty($organizationID)) {
|
||||
$organization = new \stdClass();
|
||||
$organization->id = $organizationID;
|
||||
$options['organization'] = $organization;
|
||||
$options['organization'] = (object)['id' => $organizationID];
|
||||
}
|
||||
|
||||
$user = $this->adapter->post('zones', [], $options);
|
||||
@@ -91,11 +89,7 @@ class Zones implements API
|
||||
$user = $this->adapter->get('zones', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
$result->result = $body->result;
|
||||
$result->result_info = $body->result_info;
|
||||
|
||||
return $result;
|
||||
return (object)['result' => $body->result, 'result_info' => $body->result_info];
|
||||
}
|
||||
|
||||
public function getZoneID(string $name = ''): string
|
||||
|
||||
Reference in New Issue
Block a user