Merge branch 'master' of github.com:cloudflare/cloudflare-php
This commit is contained in:
@@ -67,13 +67,11 @@ class Guzzle implements Adapter
|
|||||||
*/
|
*/
|
||||||
public function put(String $uri, array $headers = [], array $body = []): ResponseInterface
|
public function put(String $uri, array $headers = [], array $body = []): ResponseInterface
|
||||||
{
|
{
|
||||||
$jsonBody = json_encode($body);
|
|
||||||
|
|
||||||
$response = $this->client->put(
|
$response = $this->client->put(
|
||||||
$uri,
|
$uri,
|
||||||
[
|
[
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'json' => $jsonBody
|
'json' => $body
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -86,13 +84,11 @@ class Guzzle implements Adapter
|
|||||||
*/
|
*/
|
||||||
public function patch(String $uri, array $headers = [], array $body = []): ResponseInterface
|
public function patch(String $uri, array $headers = [], array $body = []): ResponseInterface
|
||||||
{
|
{
|
||||||
$jsonBody = json_encode($body);
|
|
||||||
|
|
||||||
$response = $this->client->patch(
|
$response = $this->client->patch(
|
||||||
$uri,
|
$uri,
|
||||||
[
|
[
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'json' => $jsonBody
|
'json' => $body
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class PageRulesActions implements Configurations
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBypassCacheOnCookie(bool $value)
|
public function setBypassCacheOnCookie(string $value)
|
||||||
{
|
{
|
||||||
if (preg_match('/^([a-zA-Z0-9\.=|_*-]+)$/i', $value) < 1) {
|
if (preg_match('/^([a-zA-Z0-9\.=|_*-]+)$/i', $value) < 1) {
|
||||||
throw new ConfigurationsException("Invalid cookie string.");
|
throw new ConfigurationsException("Invalid cookie string.");
|
||||||
@@ -76,7 +76,7 @@ class PageRulesActions implements Configurations
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCacheOnCookie(bool $value)
|
public function setCacheOnCookie(string $value)
|
||||||
{
|
{
|
||||||
if (preg_match('/^([a-zA-Z0-9\.=|_*-]+)$/i', $value) < 1) {
|
if (preg_match('/^([a-zA-Z0-9\.=|_*-]+)$/i', $value) < 1) {
|
||||||
throw new ConfigurationsException("Invalid cookie string.");
|
throw new ConfigurationsException("Invalid cookie string.");
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ class Zones implements API
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cachePurge(string $zoneID, array $files = [], array $tags = []): bool
|
public function cachePurge(string $zoneID, array $files = null, array $tags = null): bool
|
||||||
{
|
{
|
||||||
if (empty($files) && empty($tags)) {
|
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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class GuzzleTest extends TestCase
|
|||||||
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
||||||
|
|
||||||
$body = json_decode($response->getBody());
|
$body = json_decode($response->getBody());
|
||||||
$this->assertEquals("Testing a PUT request.", json_decode($body->json)->{"X-Put-Test"});
|
$this->assertEquals("Testing a PUT request.", $body->json->{"X-Put-Test"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPatch()
|
public function testPatch()
|
||||||
@@ -73,7 +73,7 @@ class GuzzleTest extends TestCase
|
|||||||
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
$this->assertEquals("application/json", $headers["Content-Type"][0]);
|
||||||
|
|
||||||
$body = json_decode($response->getBody());
|
$body = json_decode($response->getBody());
|
||||||
$this->assertEquals("Testing a PATCH request.", json_decode($body->json)->{"X-Patch-Test"});
|
$this->assertEquals("Testing a PATCH request.", $body->json->{"X-Patch-Test"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDelete()
|
public function testDelete()
|
||||||
|
|||||||
Reference in New Issue
Block a user