@@ -7,8 +7,7 @@ |
||
| 7 | 7 | * Interface AccessControl |
| 8 | 8 | * @package LunixREST\AccessControl |
| 9 | 9 | */ |
| 10 | -interface AccessControl |
|
| 11 | -{ |
|
| 10 | +interface AccessControl { |
|
| 12 | 11 | /** |
| 13 | 12 | * Validates if a given request should be able to access what it's trying to |
| 14 | 13 | * @param $request |
@@ -8,14 +8,12 @@ discard block |
||
| 8 | 8 | * Class PublicAccessControl |
| 9 | 9 | * @package LunixREST\AccessControl |
| 10 | 10 | */ |
| 11 | -class PublicAccessControl implements AccessControl |
|
| 12 | -{ |
|
| 11 | +class PublicAccessControl implements AccessControl { |
|
| 13 | 12 | /** |
| 14 | 13 | * @param \LunixREST\APIRequest\APIRequest $request |
| 15 | 14 | * @return bool |
| 16 | 15 | */ |
| 17 | - public function validateAccess(APIRequest $request) |
|
| 18 | - { |
|
| 16 | + public function validateAccess(APIRequest $request) { |
|
| 19 | 17 | return true; |
| 20 | 18 | } |
| 21 | 19 | |
@@ -23,8 +21,7 @@ discard block |
||
| 23 | 21 | * @param $apiKey |
| 24 | 22 | * @return bool |
| 25 | 23 | */ |
| 26 | - public function validateKey($apiKey) |
|
| 27 | - { |
|
| 24 | + public function validateKey($apiKey) { |
|
| 28 | 25 | return true; |
| 29 | 26 | } |
| 30 | 27 | } |
@@ -8,8 +8,7 @@ discard block |
||
| 8 | 8 | * Class OneKeyAccessControl |
| 9 | 9 | * @package LunixREST\AccessControl |
| 10 | 10 | */ |
| 11 | -class OneKeyAccessControl implements AccessControl |
|
| 12 | -{ |
|
| 11 | +class OneKeyAccessControl implements AccessControl { |
|
| 13 | 12 | /** |
| 14 | 13 | * @var string |
| 15 | 14 | */ |
@@ -18,8 +17,7 @@ discard block |
||
| 18 | 17 | /** |
| 19 | 18 | * @param string $key |
| 20 | 19 | */ |
| 21 | - public function __construct($key) |
|
| 22 | - { |
|
| 20 | + public function __construct($key) { |
|
| 23 | 21 | $this->key = $key; |
| 24 | 22 | } |
| 25 | 23 | |
@@ -27,8 +25,7 @@ discard block |
||
| 27 | 25 | * @param \LunixREST\APIRequest\APIRequest $request |
| 28 | 26 | * @return bool true if key is valid |
| 29 | 27 | */ |
| 30 | - public function validateAccess(APIRequest $request) |
|
| 31 | - { |
|
| 28 | + public function validateAccess(APIRequest $request) { |
|
| 32 | 29 | return $this->validateKey($request->getApiKey()); |
| 33 | 30 | } |
| 34 | 31 | |
@@ -36,8 +33,7 @@ discard block |
||
| 36 | 33 | * @param $apiKey |
| 37 | 34 | * @return bool true if key is the key specified in the constructor |
| 38 | 35 | */ |
| 39 | - public function validateKey($apiKey) |
|
| 40 | - { |
|
| 36 | + public function validateKey($apiKey) { |
|
| 41 | 37 | return $apiKey === $this->key; |
| 42 | 38 | } |
| 43 | 39 | } |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | * Class APIRequest |
| 7 | 7 | * @package LunixREST\Request |
| 8 | 8 | */ |
| 9 | -class APIRequest |
|
| 10 | -{ |
|
| 9 | +class APIRequest { |
|
| 11 | 10 | /** |
| 12 | 11 | * @var string |
| 13 | 12 | */ |
@@ -91,8 +90,7 @@ discard block |
||
| 91 | 90 | /** |
| 92 | 91 | * @return null|string |
| 93 | 92 | */ |
| 94 | - public function getElement() |
|
| 95 | - { |
|
| 93 | + public function getElement() { |
|
| 96 | 94 | return $this->element; |
| 97 | 95 | } |
| 98 | 96 | |
@@ -107,16 +105,14 @@ discard block |
||
| 107 | 105 | /** |
| 108 | 106 | * @return null|string |
| 109 | 107 | */ |
| 110 | - public function getVersion() |
|
| 111 | - { |
|
| 108 | + public function getVersion() { |
|
| 112 | 109 | return $this->version; |
| 113 | 110 | } |
| 114 | 111 | |
| 115 | 112 | /** |
| 116 | 113 | * @return null|string |
| 117 | 114 | */ |
| 118 | - public function getApiKey() |
|
| 119 | - { |
|
| 115 | + public function getApiKey() { |
|
| 120 | 116 | return $this->apiKey; |
| 121 | 117 | } |
| 122 | 118 | |
@@ -131,8 +127,7 @@ discard block |
||
| 131 | 127 | /** |
| 132 | 128 | * @return array|null|object |
| 133 | 129 | */ |
| 134 | - public function getData() |
|
| 135 | - { |
|
| 130 | + public function getData() { |
|
| 136 | 131 | return $this->data; |
| 137 | 132 | } |
| 138 | 133 | } |
@@ -15,8 +15,7 @@ |
||
| 15 | 15 | * Interface Server |
| 16 | 16 | * @package LunixREST\Server |
| 17 | 17 | */ |
| 18 | -interface Server |
|
| 19 | -{ |
|
| 18 | +interface Server { |
|
| 20 | 19 | /** |
| 21 | 20 | * @param APIRequest $request |
| 22 | 21 | * @return APIResponse |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | * @param URLParser $URLParser |
| 29 | 29 | * @param HeaderParser $headerParser |
| 30 | 30 | */ |
| 31 | - public function __construct(URLParser $URLParser, HeaderParser $headerParser) |
|
| 32 | - { |
|
| 31 | + public function __construct(URLParser $URLParser, HeaderParser $headerParser) { |
|
| 33 | 32 | $this->URLParser = $URLParser; |
| 34 | 33 | $this->headerParser = $headerParser; |
| 35 | 34 | } |
@@ -7,8 +7,7 @@ discard block |
||
| 7 | 7 | * Class LoggingEndpointFactory |
| 8 | 8 | * @package LunixREST\Endpoint |
| 9 | 9 | */ |
| 10 | -abstract class LoggingEndpointFactory implements EndpointFactory |
|
| 11 | -{ |
|
| 10 | +abstract class LoggingEndpointFactory implements EndpointFactory { |
|
| 12 | 11 | /** |
| 13 | 12 | * @var LoggerInterface |
| 14 | 13 | */ |
@@ -18,8 +17,7 @@ discard block |
||
| 18 | 17 | * LoggingEndpointFactory constructor. |
| 19 | 18 | * @param LoggerInterface $logger |
| 20 | 19 | */ |
| 21 | - public function __construct(LoggerInterface $logger) |
|
| 22 | - { |
|
| 20 | + public function __construct(LoggerInterface $logger) { |
|
| 23 | 21 | $this->logger = $logger; |
| 24 | 22 | } |
| 25 | 23 | |
@@ -8,8 +8,7 @@ discard block |
||
| 8 | 8 | * Class CachingEndpointFactory |
| 9 | 9 | * @package LunixREST\Endpoint |
| 10 | 10 | */ |
| 11 | -abstract class CachingEndpointFactory extends LoggingEndpointFactory |
|
| 12 | -{ |
|
| 11 | +abstract class CachingEndpointFactory extends LoggingEndpointFactory { |
|
| 13 | 12 | /** |
| 14 | 13 | * @var CacheItemPoolInterface |
| 15 | 14 | */ |
@@ -20,8 +19,7 @@ discard block |
||
| 20 | 19 | * @param CacheItemPoolInterface $cachePool |
| 21 | 20 | * @param LoggerInterface $logger |
| 22 | 21 | */ |
| 23 | - public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger) |
|
| 24 | - { |
|
| 22 | + public function __construct(CacheItemPoolInterface $cachePool, LoggerInterface $logger) { |
|
| 25 | 23 | $this->cachePool = $cachePool; |
| 26 | 24 | parent::__construct($logger); |
| 27 | 25 | } |
@@ -7,8 +7,7 @@ discard block |
||
| 7 | 7 | * Class CachingEndpoint |
| 8 | 8 | * @package LunixREST\Endpoint |
| 9 | 9 | */ |
| 10 | -abstract class CachingEndpoint extends LoggingEndpoint |
|
| 11 | -{ |
|
| 10 | +abstract class CachingEndpoint extends LoggingEndpoint { |
|
| 12 | 11 | /** |
| 13 | 12 | * @var CacheItemPoolInterface |
| 14 | 13 | */ |
@@ -17,8 +16,7 @@ discard block |
||
| 17 | 16 | /** |
| 18 | 17 | * @param CacheItemPoolInterface $cacheItemPool |
| 19 | 18 | */ |
| 20 | - public function setCachePool(CacheItemPoolInterface $cacheItemPool) |
|
| 21 | - { |
|
| 19 | + public function setCachePool(CacheItemPoolInterface $cacheItemPool) { |
|
| 22 | 20 | $this->cachePool = $cacheItemPool; |
| 23 | 21 | } |
| 24 | 22 | } |