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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user