Applied PSR2 formatting to existing files

This commit is contained in:
Anthony Sterling
2017-09-23 18:50:51 +01:00
parent 90196ea836
commit 2faff272df
33 changed files with 144 additions and 103 deletions

View File

@@ -72,4 +72,4 @@ interface Adapter
* @return mixed
*/
public function delete(String $uri, array $headers, array $body): ResponseInterface;
}
}

View File

@@ -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
]

View File

@@ -8,8 +8,6 @@
namespace Cloudflare\API\Adapter;
class JSONException extends \Exception
{
}
}

View File

@@ -8,8 +8,6 @@
namespace Cloudflare\API\Adapter;
class ResponseException extends \Exception
{
}
}

View File

@@ -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
];
}
}
}

View File

@@ -7,8 +7,7 @@
namespace Cloudflare\API\Auth;
interface Auth
{
public function getHeaders(): array;
}
}

View File

@@ -8,11 +8,10 @@
namespace Cloudflare\API\Auth;
class None implements Auth
{
public function getHeaders(): array
{
return [];
}
}
}

View File

@@ -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,
];
}
}
}

View File

@@ -8,8 +8,7 @@
namespace Cloudflare\API\Configurations;
interface Configurations
{
public function getArray(): array;
}
}

View File

@@ -8,8 +8,6 @@
namespace Cloudflare\API\Configurations;
class ConfigurationsException extends \Exception
{
}
}

View File

@@ -366,4 +366,4 @@ class PageRulesActions implements Configurations
{
return $this->configs;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -7,10 +7,9 @@
namespace Cloudflare\API\Endpoints;
use Cloudflare\API\Adapter\Adapter;
interface API
{
public function __construct(Adapter $adapter);
}
}

View File

@@ -121,5 +121,4 @@ class DNS implements API
return false;
}
}
}

View File

@@ -8,8 +8,6 @@
namespace Cloudflare\API\Endpoints;
class EndpointException extends \Exception
{
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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());
}
}
}

View File

@@ -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;
}
}
}