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.
33 lines
591 B
PHP
33 lines
591 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: junade
|
|
* Date: 19/09/2017
|
|
* Time: 18:37
|
|
*/
|
|
|
|
namespace Cloudflare\API\Configurations;
|
|
|
|
class PageRulesTargets implements Configurations
|
|
{
|
|
private $targets;
|
|
|
|
public function __construct(string $queryUrl)
|
|
{
|
|
$this->targets = [
|
|
[
|
|
'target' => 'url',
|
|
'constraint' => [
|
|
'operator' => 'matches',
|
|
'value' => $queryUrl
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
public function getArray(): array
|
|
{
|
|
return $this->targets;
|
|
}
|
|
}
|