Code cleanup / Quality of Life updates
Adapter::get, post, put, patch and delete all had non-optional parameters for $headers and $query or $body. These have been made optional. I also re-ordered the parameters as $headers was never used while $query/$body were heavily used. I also condensed and removed some duplicate calls so that every call to Adapter::get/post sends that call to Adapter::request. It could use a magic method to do this but it might make it more difficult to test.
This commit is contained in:
@@ -15,9 +15,9 @@ class PageRulesTargets implements Configurations
|
||||
public function __construct(string $queryUrl)
|
||||
{
|
||||
$this->targets = [
|
||||
(object)[
|
||||
[
|
||||
'target' => 'url',
|
||||
'constraint' => (object)[
|
||||
'constraint' => [
|
||||
'operator' => 'matches',
|
||||
'value' => $queryUrl
|
||||
]
|
||||
|
||||
@@ -14,7 +14,7 @@ class UARules implements Configurations
|
||||
|
||||
public function addUA(string $value)
|
||||
{
|
||||
$this->configs[] = (object)['target' => 'ua', 'value' => $value];
|
||||
$this->configs[] = ['target' => 'ua', 'value' => $value];
|
||||
}
|
||||
|
||||
public function getArray(): array
|
||||
|
||||
@@ -14,12 +14,12 @@ class ZoneLockdown implements Configurations
|
||||
|
||||
public function addIP(string $value)
|
||||
{
|
||||
$this->configs[] = (object)['target' => 'ip', 'value' => $value];
|
||||
$this->configs[] = ['target' => 'ip', 'value' => $value];
|
||||
}
|
||||
|
||||
public function addIPRange(string $value)
|
||||
{
|
||||
$this->configs[] = (object)['target' => 'ip_range', 'value' => $value];
|
||||
$this->configs[] = ['target' => 'ip_range', 'value' => $value];
|
||||
}
|
||||
|
||||
public function getArray(): array
|
||||
|
||||
Reference in New Issue
Block a user