diff --git a/src/Adapter/Adapter.php b/src/Adapter/Adapter.php index b8416dd..9c4775e 100644 --- a/src/Adapter/Adapter.php +++ b/src/Adapter/Adapter.php @@ -72,4 +72,4 @@ interface Adapter * @return mixed */ public function delete(String $uri, array $headers, array $body): ResponseInterface; -} \ No newline at end of file +} diff --git a/src/Adapter/Guzzle.php b/src/Adapter/Guzzle.php index 84e4222..aa858ba 100644 --- a/src/Adapter/Guzzle.php +++ b/src/Adapter/Guzzle.php @@ -7,7 +7,6 @@ namespace Cloudflare\API\Adapter; - use Cloudflare\API\Auth\Auth; use GuzzleHttp\Client; use Psr\Http\Message\ResponseInterface; @@ -44,7 +43,6 @@ class Guzzle implements Adapter $this->checkError($response); return $response; - } /** @@ -52,7 +50,9 @@ class Guzzle implements Adapter */ public function post(String $uri, array $headers = array(), array $body = array()): ResponseInterface { - $response = $this->client->post($uri, [ + $response = $this->client->post( + $uri, + [ 'headers' => $headers, 'json' => $body ] @@ -69,7 +69,9 @@ class Guzzle implements Adapter { $jsonBody = json_encode($body); - $response = $this->client->put($uri, [ + $response = $this->client->put( + $uri, + [ 'headers' => $headers, 'json' => $jsonBody ] @@ -86,7 +88,9 @@ class Guzzle implements Adapter { $jsonBody = json_encode($body); - $response = $this->client->patch($uri, [ + $response = $this->client->patch( + $uri, + [ 'headers' => $headers, 'json' => $jsonBody ] @@ -101,7 +105,9 @@ class Guzzle implements Adapter */ public function delete(String $uri, array $headers = array(), array $body = array()): ResponseInterface { - $response = $this->client->delete($uri, [ + $response = $this->client->delete( + $uri, + [ 'headers' => $headers, 'json' => $body ] diff --git a/src/Adapter/JSONException.php b/src/Adapter/JSONException.php index 34ee75e..e9da7e4 100644 --- a/src/Adapter/JSONException.php +++ b/src/Adapter/JSONException.php @@ -8,8 +8,6 @@ namespace Cloudflare\API\Adapter; - class JSONException extends \Exception { - -} \ No newline at end of file +} diff --git a/src/Adapter/ResponseException.php b/src/Adapter/ResponseException.php index 845a6dd..22c01d4 100644 --- a/src/Adapter/ResponseException.php +++ b/src/Adapter/ResponseException.php @@ -8,8 +8,6 @@ namespace Cloudflare\API\Adapter; - class ResponseException extends \Exception { - -} \ No newline at end of file +} diff --git a/src/Auth/APIKey.php b/src/Auth/APIKey.php index aa52406..ddfb1ac 100644 --- a/src/Auth/APIKey.php +++ b/src/Auth/APIKey.php @@ -7,7 +7,6 @@ namespace Cloudflare\API\Auth; - class APIKey implements Auth { private $email; @@ -26,4 +25,4 @@ class APIKey implements Auth 'X-Auth-Key' => $this->apiKey ]; } -} \ No newline at end of file +} diff --git a/src/Auth/Auth.php b/src/Auth/Auth.php index e22faaa..55cead8 100644 --- a/src/Auth/Auth.php +++ b/src/Auth/Auth.php @@ -7,8 +7,7 @@ namespace Cloudflare\API\Auth; - interface Auth { public function getHeaders(): array; -} \ No newline at end of file +} diff --git a/src/Auth/None.php b/src/Auth/None.php index aa203e3..0c8efd5 100644 --- a/src/Auth/None.php +++ b/src/Auth/None.php @@ -8,11 +8,10 @@ namespace Cloudflare\API\Auth; - class None implements Auth { public function getHeaders(): array { return []; } -} \ No newline at end of file +} diff --git a/src/Auth/UserServiceKey.php b/src/Auth/UserServiceKey.php index fcc4f14..7f07d8b 100644 --- a/src/Auth/UserServiceKey.php +++ b/src/Auth/UserServiceKey.php @@ -7,7 +7,6 @@ namespace Cloudflare\API\Auth; - class UserServiceKey implements Auth { private $userServiceKey; @@ -23,4 +22,4 @@ class UserServiceKey implements Auth 'X-Auth-User-Service-Key' => $this->userServiceKey, ]; } -} \ No newline at end of file +} diff --git a/src/Configurations/Configurations.php b/src/Configurations/Configurations.php index bdcbdb2..ba20907 100644 --- a/src/Configurations/Configurations.php +++ b/src/Configurations/Configurations.php @@ -8,8 +8,7 @@ namespace Cloudflare\API\Configurations; - interface Configurations { public function getArray(): array; -} \ No newline at end of file +} diff --git a/src/Configurations/ConfigurationsException.php b/src/Configurations/ConfigurationsException.php index ece1687..23aade6 100644 --- a/src/Configurations/ConfigurationsException.php +++ b/src/Configurations/ConfigurationsException.php @@ -8,8 +8,6 @@ namespace Cloudflare\API\Configurations; - class ConfigurationsException extends \Exception { - -} \ No newline at end of file +} diff --git a/src/Configurations/PageRulesActions.php b/src/Configurations/PageRulesActions.php index b1cbcb0..931fc17 100644 --- a/src/Configurations/PageRulesActions.php +++ b/src/Configurations/PageRulesActions.php @@ -366,4 +366,4 @@ class PageRulesActions implements Configurations { return $this->configs; } -} \ No newline at end of file +} diff --git a/src/Configurations/PageRulesTargets.php b/src/Configurations/PageRulesTargets.php index 24c43a2..82d9777 100644 --- a/src/Configurations/PageRulesTargets.php +++ b/src/Configurations/PageRulesTargets.php @@ -8,7 +8,6 @@ namespace Cloudflare\API\Configurations; - class PageRulesTargets implements Configurations { private $targets; @@ -28,4 +27,4 @@ class PageRulesTargets implements Configurations { return $this->targets; } -} \ No newline at end of file +} diff --git a/src/Configurations/UARules.php b/src/Configurations/UARules.php index d7e989b..3bed629 100644 --- a/src/Configurations/UARules.php +++ b/src/Configurations/UARules.php @@ -8,7 +8,6 @@ namespace Cloudflare\API\Configurations; - class UARules implements Configurations { private $configs = array(); @@ -26,4 +25,4 @@ class UARules implements Configurations { return $this->configs; } -} \ No newline at end of file +} diff --git a/src/Configurations/ZoneLockdown.php b/src/Configurations/ZoneLockdown.php index c4d6da3..644bde4 100644 --- a/src/Configurations/ZoneLockdown.php +++ b/src/Configurations/ZoneLockdown.php @@ -8,7 +8,6 @@ namespace Cloudflare\API\Configurations; - class ZoneLockdown implements Configurations { private $configs = array(); @@ -35,4 +34,4 @@ class ZoneLockdown implements Configurations { return $this->configs; } -} \ No newline at end of file +} diff --git a/src/Endpoints/API.php b/src/Endpoints/API.php index ebcaab0..113075f 100644 --- a/src/Endpoints/API.php +++ b/src/Endpoints/API.php @@ -7,10 +7,9 @@ namespace Cloudflare\API\Endpoints; - use Cloudflare\API\Adapter\Adapter; interface API { public function __construct(Adapter $adapter); -} \ No newline at end of file +} diff --git a/src/Endpoints/DNS.php b/src/Endpoints/DNS.php index 06cedae..9adb9aa 100644 --- a/src/Endpoints/DNS.php +++ b/src/Endpoints/DNS.php @@ -121,5 +121,4 @@ class DNS implements API return false; } - -} \ No newline at end of file +} diff --git a/src/Endpoints/EndpointException.php b/src/Endpoints/EndpointException.php index 92b0671..2855e00 100644 --- a/src/Endpoints/EndpointException.php +++ b/src/Endpoints/EndpointException.php @@ -8,8 +8,6 @@ namespace Cloudflare\API\Endpoints; - class EndpointException extends \Exception { - -} \ No newline at end of file +} diff --git a/src/Endpoints/IPs.php b/src/Endpoints/IPs.php index 0745907..0ce79c0 100644 --- a/src/Endpoints/IPs.php +++ b/src/Endpoints/IPs.php @@ -8,7 +8,6 @@ namespace Cloudflare\API\Endpoints; - use Cloudflare\API\Adapter\Adapter; class IPs implements API @@ -20,10 +19,11 @@ class IPs implements API $this->adapter = $adapter; } - public function listIPs(): \stdClass { + public function listIPs(): \stdClass + { $ips = $this->adapter->get('ips', [], []); $body = json_decode($ips->getBody()); return $body->result; } -} \ No newline at end of file +} diff --git a/src/Endpoints/PageRules.php b/src/Endpoints/PageRules.php index fe6c7e0..d171c61 100644 --- a/src/Endpoints/PageRules.php +++ b/src/Endpoints/PageRules.php @@ -8,7 +8,6 @@ namespace Cloudflare\API\Endpoints; - use Cloudflare\API\Adapter\Adapter; use Cloudflare\API\Configurations\PageRulesActions; use Cloudflare\API\Configurations\PageRulesTargets; @@ -146,4 +145,4 @@ class PageRules implements API return false; } -} \ No newline at end of file +} diff --git a/src/Endpoints/UARules.php b/src/Endpoints/UARules.php index 698fd71..8741eab 100644 --- a/src/Endpoints/UARules.php +++ b/src/Endpoints/UARules.php @@ -46,7 +46,6 @@ class UARules implements API string $id = null, string $description = null ): bool { - $options = [ 'mode' => $mode, 'configurations' => $configuration->getArray() @@ -85,7 +84,6 @@ class UARules implements API \Cloudflare\API\Configurations\UARules $configuration, string $description = null ): bool { - $options = [ 'mode' => $mode, 'id' => $ruleID, @@ -119,4 +117,4 @@ class UARules implements API return false; } -} \ No newline at end of file +} diff --git a/src/Endpoints/User.php b/src/Endpoints/User.php index 0ee5dd0..1be88ff 100644 --- a/src/Endpoints/User.php +++ b/src/Endpoints/User.php @@ -7,7 +7,6 @@ namespace Cloudflare\API\Endpoints; - use Cloudflare\API\Adapter\Adapter; class User implements API @@ -41,4 +40,4 @@ class User implements API $response = $this->adapter->patch("user", [], $details); return json_decode($response->getBody()); } -} \ No newline at end of file +} diff --git a/src/Endpoints/ZoneLockdown.php b/src/Endpoints/ZoneLockdown.php index 0aba048..985d232 100644 --- a/src/Endpoints/ZoneLockdown.php +++ b/src/Endpoints/ZoneLockdown.php @@ -46,7 +46,6 @@ class ZoneLockdown implements API string $id = null, string $description = null ): bool { - $options = [ 'urls' => $urls, 'configurations' => $configuration->getArray() @@ -85,7 +84,6 @@ class ZoneLockdown implements API \Cloudflare\API\Configurations\ZoneLockdown $configuration, string $description = null ): bool { - $options = [ 'urls' => $urls, 'id' => $lockdownID, @@ -119,4 +117,4 @@ class ZoneLockdown implements API return false; } -} \ No newline at end of file +} diff --git a/tests/Adapter/GuzzleTest.php b/tests/Adapter/GuzzleTest.php index f5e21a8..2ef16e6 100644 --- a/tests/Adapter/GuzzleTest.php +++ b/tests/Adapter/GuzzleTest.php @@ -63,8 +63,11 @@ class GuzzleTest extends PHPUnit_Framework_TestCase public function testPatch() { - $response = $this->client->patch('https://httpbin.org/patch', [], - ['X-Patch-Test' => 'Testing a PATCH request.']); + $response = $this->client->patch( + 'https://httpbin.org/patch', + [], + ['X-Patch-Test' => 'Testing a PATCH request.'] + ); $headers = $response->getHeaders(); $this->assertEquals("application/json", $headers["Content-Type"][0]); @@ -75,8 +78,11 @@ class GuzzleTest extends PHPUnit_Framework_TestCase public function testDelete() { - $response = $this->client->delete('https://httpbin.org/delete', [], - ['X-Delete-Test' => 'Testing a DELETE request.']); + $response = $this->client->delete( + 'https://httpbin.org/delete', + [], + ['X-Delete-Test' => 'Testing a DELETE request.'] + ); $headers = $response->getHeaders(); $this->assertEquals("application/json", $headers["Content-Type"][0]); @@ -124,9 +130,9 @@ class GuzzleTest extends PHPUnit_Framework_TestCase $method->invokeArgs($this->client, [$response]); } - public function testNotFound() { + public function testNotFound() + { $this->expectException(\GuzzleHttp\Exception\RequestException::class); $response = $this->client->get('https://httpbin.org/status/404'); - } } diff --git a/tests/Auth/APIKeyTest.php b/tests/Auth/APIKeyTest.php index 355d071..35ea509 100644 --- a/tests/Auth/APIKeyTest.php +++ b/tests/Auth/APIKeyTest.php @@ -19,6 +19,5 @@ class APIKeyTest extends PHPUnit_Framework_TestCase $this->assertEquals('1234567893feefc5f0q5000bfo0c38d90bbeb', $headers['X-Auth-Key']); $this->assertEquals(2, sizeof($headers)); - } } diff --git a/tests/Auth/UserServiceKeyTest.php b/tests/Auth/UserServiceKeyTest.php index b0a367d..10955c4 100644 --- a/tests/Auth/UserServiceKeyTest.php +++ b/tests/Auth/UserServiceKeyTest.php @@ -14,10 +14,11 @@ class UserServiceKeyTest extends PHPUnit_Framework_TestCase $this->assertArrayHasKey('X-Auth-User-Service-Key', $headers); - $this->assertEquals('v1.0-e24fd090c02efcfecb4de8f4ff246fd5c75b48946fdf0ce26c59f91d0d90797b-cfa33fe60e8e34073c149323454383fc9005d25c9b4c502c2f063457ef65322eade065975001a0b4b4c591c5e1bd36a6e8f7e2d4fa8a9ec01c64c041e99530c2-07b9efe0acd78c82c8d9c690aacb8656d81c369246d7f996a205fe3c18e9254a', - $headers['X-Auth-User-Service-Key']); + $this->assertEquals( + 'v1.0-e24fd090c02efcfecb4de8f4ff246fd5c75b48946fdf0ce26c59f91d0d90797b-cfa33fe60e8e34073c149323454383fc9005d25c9b4c502c2f063457ef65322eade065975001a0b4b4c591c5e1bd36a6e8f7e2d4fa8a9ec01c64c041e99530c2-07b9efe0acd78c82c8d9c690aacb8656d81c369246d7f996a205fe3c18e9254a', + $headers['X-Auth-User-Service-Key'] + ); $this->assertEquals(1, sizeof($headers)); - } } diff --git a/tests/Configurations/ConfigurationsUARulesTest.php b/tests/Configurations/ConfigurationsUARulesTest.php index 2ee461e..529e84d 100644 --- a/tests/Configurations/ConfigurationsUARulesTest.php +++ b/tests/Configurations/ConfigurationsUARulesTest.php @@ -19,7 +19,9 @@ class ConfigurationsUARulesTest extends PHPUnit_Framework_TestCase $this->assertObjectHasAttribute('target', $array[0]); $this->assertEquals('ua', $array[0]->target); $this->assertObjectHasAttribute('value', $array[0]); - $this->assertEquals('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4', - $array[0]->value); + $this->assertEquals( + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4', + $array[0]->value + ); } } diff --git a/tests/Configurations/PageRulesTargetTest.php b/tests/Configurations/PageRulesTargetTest.php index 4a9cb3d..8b2f4cf 100644 --- a/tests/Configurations/PageRulesTargetTest.php +++ b/tests/Configurations/PageRulesTargetTest.php @@ -10,7 +10,8 @@ use Cloudflare\API\Configurations\PageRulesTargets; class PageRulesTargetTest extends PHPUnit_Framework_TestCase { - public function testGetArray() { + public function testGetArray() + { $targets = new PageRulesTargets('junade.com/*'); $array = $targets->getArray(); diff --git a/tests/Endpoints/DNSTest.php b/tests/Endpoints/DNSTest.php index 3c97eb5..f5267bb 100644 --- a/tests/Endpoints/DNSTest.php +++ b/tests/Endpoints/DNSTest.php @@ -37,7 +37,9 @@ class DNSTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('post') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'), $this->equalTo([]), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'), + $this->equalTo([]), $this->equalTo([ 'type' => 'A', 'name' => 'example.com', @@ -88,7 +90,8 @@ class DNSTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records'), $this->equalTo([ 'page' => 1, 'per_page' => 20, @@ -102,7 +105,7 @@ class DNSTest extends PHPUnit_Framework_TestCase ); $zones = new \Cloudflare\API\Endpoints\DNS($mock); - $result = $zones->listRecords("023e105f4ecef8ad9ca31a8372d0c353","A", "example.com", "127.0.0.1", 1, 20, "type", "desc", "all"); + $result = $zones->listRecords("023e105f4ecef8ad9ca31a8372d0c353", "A", "example.com", "127.0.0.1", 1, 20, "type", "desc", "all"); $this->assertObjectHasAttribute('result', $result); $this->assertObjectHasAttribute('result_info', $result); @@ -140,7 +143,8 @@ class DNSTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records/372e67954025e0ba6aaa6d586b9e0b59'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records/372e67954025e0ba6aaa6d586b9e0b59'), $this->equalTo([]) ); diff --git a/tests/Endpoints/IPsTest.php b/tests/Endpoints/IPsTest.php index 1a47bf8..2be3942 100644 --- a/tests/Endpoints/IPsTest.php +++ b/tests/Endpoints/IPsTest.php @@ -10,7 +10,8 @@ use Cloudflare\API\Endpoints\IPs; class IPsTest extends PHPUnit_Framework_TestCase { - public function testListIPs() { + public function testListIPs() + { $stream = GuzzleHttp\Psr7\stream_for(' { "success": true, @@ -31,7 +32,9 @@ class IPsTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('ips'), $this->equalTo([]) + ->with( + $this->equalTo('ips'), + $this->equalTo([]) ); $ips = new \Cloudflare\API\Endpoints\IPs($mock); diff --git a/tests/Endpoints/PageRulesTest.php b/tests/Endpoints/PageRulesTest.php index fc040f4..d8cf688 100644 --- a/tests/Endpoints/PageRulesTest.php +++ b/tests/Endpoints/PageRulesTest.php @@ -53,7 +53,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('post') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), $this->equalTo([]), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), + $this->equalTo([]), $this->equalTo([ 'targets' => $target->getArray(), 'actions' => $action->getArray(), @@ -116,7 +118,8 @@ class PageRulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), $this->equalTo([ 'status' => 'active', 'order' => 'status', @@ -170,7 +173,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'), $this->equalTo([]) + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'), + $this->equalTo([]) ); $pr = new \Cloudflare\API\Endpoints\PageRules($mock); @@ -220,7 +225,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('patch') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), $this->equalTo([]), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules'), + $this->equalTo([]), $this->equalTo([ 'targets' => $target->getArray(), 'actions' => $action->getArray(), @@ -256,7 +263,9 @@ class PageRulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('delete') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'), $this->equalTo([]), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/pagerules/9a7806061c88ada191ed06f989cc3dac'), + $this->equalTo([]), $this->equalTo([]) ); diff --git a/tests/Endpoints/UARulesTest.php b/tests/Endpoints/UARulesTest.php index 58d2b59..7cf93cc 100644 --- a/tests/Endpoints/UARulesTest.php +++ b/tests/Endpoints/UARulesTest.php @@ -45,7 +45,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'), $this->equalTo([ 'page' => 1, 'per_page' => 20 @@ -93,7 +94,9 @@ class UARulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('post') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'), $this->equalTo([]), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules'), + $this->equalTo([]), $this->equalTo([ 'mode' => 'js_challenge', 'id' => '372e67954025e0ba6aaa6d586b9e0b59', @@ -103,9 +106,13 @@ class UARulesTest extends PHPUnit_Framework_TestCase ); $ld = new \Cloudflare\API\Endpoints\UARules($mock); - $ld->createRule('023e105f4ecef8ad9ca31a8372d0c353', 'js_challenge', $config, + $ld->createRule( + '023e105f4ecef8ad9ca31a8372d0c353', + 'js_challenge', + $config, '372e67954025e0ba6aaa6d586b9e0b59', - 'Prevent access from abusive clients identified by this UserAgent to mitigate DDoS attack'); + 'Prevent access from abusive clients identified by this UserAgent to mitigate DDoS attack' + ); } public function getRuleDetails() @@ -135,7 +142,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'), $this->equalTo([]) ); @@ -175,7 +183,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('put') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'), $this->equalTo([]), $this->equalTo([ 'mode' => 'js_challenge', @@ -186,9 +195,13 @@ class UARulesTest extends PHPUnit_Framework_TestCase ); $ld = new \Cloudflare\API\Endpoints\UARules($mock); - $ld->updateRule('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59', - 'js_challenge', $config, - 'Restrict access to these endpoints to requests from a known IP address'); + $ld->updateRule( + '023e105f4ecef8ad9ca31a8372d0c353', + '372e67954025e0ba6aaa6d586b9e0b59', + 'js_challenge', + $config, + 'Restrict access to these endpoints to requests from a known IP address' + ); } public function testDeleteRule() @@ -211,7 +224,8 @@ class UARulesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('delete') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/ua_rules/372e67954025e0ba6aaa6d586b9e0b59'), $this->equalTo([]), $this->equalTo([]) ); diff --git a/tests/Endpoints/ZoneLockdownTest.php b/tests/Endpoints/ZoneLockdownTest.php index 81d03fb..9783110 100644 --- a/tests/Endpoints/ZoneLockdownTest.php +++ b/tests/Endpoints/ZoneLockdownTest.php @@ -43,7 +43,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'), $this->equalTo([ 'page' => 1, 'per_page' => 20, @@ -91,7 +92,9 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('post') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'), $this->equalTo([]), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns'), + $this->equalTo([]), $this->equalTo([ 'urls' => ["api.mysite.com/some/endpoint*"], 'id' => '372e67954025e0ba6aaa6d586b9e0b59', @@ -101,9 +104,13 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase ); $ld = new \Cloudflare\API\Endpoints\ZoneLockdown($mock); - $ld->createLockdown('023e105f4ecef8ad9ca31a8372d0c353', ["api.mysite.com/some/endpoint*"], $config, + $ld->createLockdown( + '023e105f4ecef8ad9ca31a8372d0c353', + ["api.mysite.com/some/endpoint*"], + $config, '372e67954025e0ba6aaa6d586b9e0b59', - 'Restrict access to these endpoints to requests from a known IP address'); + 'Restrict access to these endpoints to requests from a known IP address' + ); } public function testGetRecordDetails() @@ -137,7 +144,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'), $this->equalTo([]) ); @@ -181,7 +189,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('put') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'), $this->equalTo([]), $this->equalTo([ 'urls' => ["api.mysite.com/some/endpoint*"], @@ -192,9 +201,13 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase ); $ld = new \Cloudflare\API\Endpoints\ZoneLockdown($mock); - $ld->updateLockdown('023e105f4ecef8ad9ca31a8372d0c353', '372e67954025e0ba6aaa6d586b9e0b59', - ["api.mysite.com/some/endpoint*"], $config, - 'Restrict access to these endpoints to requests from a known IP address'); + $ld->updateLockdown( + '023e105f4ecef8ad9ca31a8372d0c353', + '372e67954025e0ba6aaa6d586b9e0b59', + ["api.mysite.com/some/endpoint*"], + $config, + 'Restrict access to these endpoints to requests from a known IP address' + ); } public function testDeleteLockdown() @@ -221,7 +234,8 @@ class ZoneLockdownTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('delete') - ->with($this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'), + ->with( + $this->equalTo('zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/lockdowns/372e67954025e0ba6aaa6d586b9e0b59'), $this->equalTo([]), $this->equalTo([]) ); diff --git a/tests/Endpoints/ZonesTest.php b/tests/Endpoints/ZonesTest.php index d1026ed..8ce838c 100644 --- a/tests/Endpoints/ZonesTest.php +++ b/tests/Endpoints/ZonesTest.php @@ -70,7 +70,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('post') - ->with($this->equalTo('zones'), + ->with( + $this->equalTo('zones'), $this->equalTo([]), $this->equalTo(['name' => 'example.com', 'jumpstart' => false]) ); @@ -90,7 +91,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('post') - ->with($this->equalTo('zones'), + ->with( + $this->equalTo('zones'), $this->equalTo([]), $this->equalTo(['name' => 'example.com', 'jumpstart' => true, 'organization' => $org]) ); @@ -115,7 +117,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('put') - ->with($this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/activation_check'), + ->with( + $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/activation_check'), $this->equalTo([]), $this->equalTo([]) ); @@ -196,7 +199,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones'), + ->with( + $this->equalTo('zones'), $this->equalTo([ 'page' => 1, 'per_page' => 20, @@ -289,7 +293,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('get') - ->with($this->equalTo('zones'), + ->with( + $this->equalTo('zones'), $this->equalTo([ 'page' => 1, 'per_page' => 20, @@ -321,7 +326,8 @@ class ZonesTest extends PHPUnit_Framework_TestCase $mock->expects($this->once()) ->method('delete') - ->with($this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'), + ->with( + $this->equalTo('zones/c2547eb745079dac9320b638f5e225cf483cc5cfdda41/purge_cache'), $this->equalTo([]), $this->equalTo(["purge_everything" => true]) );