@@ -47,13 +47,13 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $method = $this->mapEndpointMethod($request); |
| 49 | 49 | if (!method_exists($endpoint, $method)) { |
| 50 | - throw new MethodNotFoundException("The endpoint method " . $method . " was not found"); |
|
| 50 | + throw new MethodNotFoundException("The endpoint method ".$method." was not found"); |
|
| 51 | 51 | } |
| 52 | 52 | return call_user_func([$endpoint, $method], $request); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | protected function mapEndpointMethod(APIRequest $request): string |
| 56 | 56 | { |
| 57 | - return strtolower($request->getMethod()) . (!$request->getElement() ? 'All': ''); |
|
| 57 | + return strtolower($request->getMethod()).(!$request->getElement() ? 'All' : ''); |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * Class GenericRouter |
| 12 | 12 | * @package LunixREST\Server |
| 13 | 13 | */ |
| 14 | -class GenericRouter implements Router |
|
| 15 | -{ |
|
| 14 | +class GenericRouter implements Router { |
|
| 16 | 15 | /** |
| 17 | 16 | * @var EndpointFactory |
| 18 | 17 | */ |
@@ -22,8 +21,7 @@ discard block |
||
| 22 | 21 | * DefaultRouter constructor. |
| 23 | 22 | * @param EndpointFactory $endpointFactory |
| 24 | 23 | */ |
| 25 | - public function __construct(EndpointFactory $endpointFactory) |
|
| 26 | - { |
|
| 24 | + public function __construct(EndpointFactory $endpointFactory) { |
|
| 27 | 25 | $this->endpointFactory = $endpointFactory; |
| 28 | 26 | } |
| 29 | 27 | |
@@ -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 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $this->config = parse_ini_file($filename, true); |
| 25 | 25 | |
| 26 | 26 | if ($this->config === false) { |
| 27 | - throw new INIParseException('Could not parse: ' . $filename, true); |
|
| 27 | + throw new INIParseException('Could not parse: '.$filename, true); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
@@ -8,8 +8,7 @@ discard block |
||
| 8 | 8 | * Class INIConfiguration |
| 9 | 9 | * @package LunixREST\Configuration |
| 10 | 10 | */ |
| 11 | -class INIConfiguration implements Configuration |
|
| 12 | -{ |
|
| 11 | +class INIConfiguration implements Configuration { |
|
| 13 | 12 | /** |
| 14 | 13 | * @var |
| 15 | 14 | */ |
@@ -19,8 +18,7 @@ discard block |
||
| 19 | 18 | * @param string $filename |
| 20 | 19 | * @throws INIParseException |
| 21 | 20 | */ |
| 22 | - public function __construct($filename) |
|
| 23 | - { |
|
| 21 | + public function __construct($filename) { |
|
| 24 | 22 | $this->config = parse_ini_file($filename, true); |
| 25 | 23 | |
| 26 | 24 | if ($this->config === false) { |
@@ -33,8 +31,7 @@ discard block |
||
| 33 | 31 | * @param $namespace |
| 34 | 32 | * @return mixed |
| 35 | 33 | */ |
| 36 | - public function get($key, $namespace) |
|
| 37 | - { |
|
| 34 | + public function get($key, $namespace) { |
|
| 38 | 35 | return $this->config[$namespace][$key] ?? null; |
| 39 | 36 | } |
| 40 | 37 | |
@@ -7,8 +7,7 @@ |
||
| 7 | 7 | * Interface Throttle |
| 8 | 8 | * @package LunixREST\Throttle |
| 9 | 9 | */ |
| 10 | -interface Throttle |
|
| 11 | -{ |
|
| 10 | +interface Throttle { |
|
| 12 | 11 | /** |
| 13 | 12 | * Returns true if the given request should be throttled in our implementation |
| 14 | 13 | * @param \LunixREST\APIRequest\APIRequest $request |
@@ -9,10 +9,8 @@ |
||
| 9 | 9 | * Class BasicRequestFactory |
| 10 | 10 | * @package LunixREST\Request\RequestFactory |
| 11 | 11 | */ |
| 12 | -class DefaultRequestFactory extends GenericRequestFactory |
|
| 13 | -{ |
|
| 14 | - public function __construct(URLParser $URLParser) |
|
| 15 | - { |
|
| 12 | +class DefaultRequestFactory extends GenericRequestFactory { |
|
| 13 | + public function __construct(URLParser $URLParser) { |
|
| 16 | 14 | parent::__construct($URLParser, new DefaultHeaderParser()); |
| 17 | 15 | } |
| 18 | 16 | } |
@@ -5,8 +5,7 @@ |
||
| 5 | 5 | * Interface Configuration |
| 6 | 6 | * @package LunixREST\Configuration |
| 7 | 7 | */ |
| 8 | -interface Configuration |
|
| 9 | -{ |
|
| 8 | +interface Configuration { |
|
| 10 | 9 | /** |
| 11 | 10 | * @param $key |
| 12 | 11 | * @param null|string $namespace |
@@ -11,8 +11,7 @@ |
||
| 11 | 11 | * Interface Router |
| 12 | 12 | * @package LunixREST\Server |
| 13 | 13 | */ |
| 14 | -interface Router |
|
| 15 | -{ |
|
| 14 | +interface Router { |
|
| 16 | 15 | /** |
| 17 | 16 | * @param APIRequest $request |
| 18 | 17 | * @return APIResponseData |