@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | * Class GenericRouter |
11 | 11 | * @package LunixREST\Server |
12 | 12 | */ |
13 | -class GenericRouter implements Router |
|
14 | -{ |
|
13 | +class GenericRouter implements Router { |
|
15 | 14 | /** |
16 | 15 | * @var EndpointFactory |
17 | 16 | */ |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | * DefaultRouter constructor. |
22 | 21 | * @param EndpointFactory $endpointFactory |
23 | 22 | */ |
24 | - public function __construct(EndpointFactory $endpointFactory) |
|
25 | - { |
|
23 | + public function __construct(EndpointFactory $endpointFactory) { |
|
26 | 24 | $this->endpointFactory = $endpointFactory; |
27 | 25 | } |
28 | 26 | |
@@ -31,8 +29,7 @@ discard block |
||
31 | 29 | * @return null|object|array |
32 | 30 | * @throws MethodNotFoundException |
33 | 31 | */ |
34 | - public function route(APIRequest $request) |
|
35 | - { |
|
32 | + public function route(APIRequest $request) { |
|
36 | 33 | $endpoint = $this->endpointFactory->getEndpoint($request->getEndpoint(), $request->getVersion()); |
37 | 34 | return $this->executeEndpoint($endpoint, $request); |
38 | 35 | } |
@@ -43,8 +40,7 @@ discard block |
||
43 | 40 | * @return null|object|array |
44 | 41 | * @throws MethodNotFoundException |
45 | 42 | */ |
46 | - protected function executeEndpoint(Endpoint $endpoint, APIRequest $request) |
|
47 | - { |
|
43 | + protected function executeEndpoint(Endpoint $endpoint, APIRequest $request) { |
|
48 | 44 | $method = $this->mapEndpointMethod($request); |
49 | 45 | if (!method_exists($endpoint, $method)) { |
50 | 46 | throw new MethodNotFoundException("The endpoint method " . $method . " was not found"); |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | use Psr\Log\LoggerAwareTrait; |
16 | 16 | use Psr\Log\LoggerInterface; |
17 | 17 | |
18 | -class HTTPServer |
|
19 | -{ |
|
18 | +class HTTPServer { |
|
20 | 19 | use LoggerAwareTrait; |
21 | 20 | |
22 | 21 | /** |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | * @param RequestFactory $requestFactory |
35 | 34 | * @param LoggerInterface $logger |
36 | 35 | */ |
37 | - public function __construct(Server $server, RequestFactory $requestFactory, LoggerInterface $logger) |
|
38 | - { |
|
36 | + public function __construct(Server $server, RequestFactory $requestFactory, LoggerInterface $logger) { |
|
39 | 37 | $this->server = $server; |
40 | 38 | $this->requestFactory = $requestFactory; |
41 | 39 | $this->logger = $logger; |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | } |
66 | 64 | } |
67 | 65 | |
68 | - protected function handleAPIRequest(APIRequest $APIRequest, ResponseInterface $response) |
|
69 | - { |
|
66 | + protected function handleAPIRequest(APIRequest $APIRequest, ResponseInterface $response) { |
|
70 | 67 | try { |
71 | 68 | $APIResponse = $this->server->handleRequest($APIRequest); |
72 | 69 |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Psr\Log\LoggerAwareTrait; |
5 | 5 | |
6 | -abstract class LoggingEndpoint implements Endpoint |
|
7 | -{ |
|
6 | +abstract class LoggingEndpoint implements Endpoint { |
|
8 | 7 | use LoggerAwareTrait; |
9 | 8 | } |
@@ -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 | } |
@@ -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 |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\APIResponse\Exceptions; |
3 | 3 | |
4 | -class NotAcceptableResponseTypeException extends \Exception |
|
5 | -{ |
|
4 | +class NotAcceptableResponseTypeException extends \Exception { |
|
6 | 5 | |
7 | 6 | } |
@@ -3,8 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use LunixREST\APIResponse\Exceptions\NotAcceptableResponseTypeException; |
5 | 5 | |
6 | -interface ResponseFactory |
|
7 | -{ |
|
6 | +interface ResponseFactory { |
|
8 | 7 | /** |
9 | 8 | * @param null|object|array $data |
10 | 9 | * @param array $acceptedMIMETypes - acceptable MIME types in order of preference |