@@ -10,8 +10,7 @@ |
||
10 | 10 | * Interface Router |
11 | 11 | * @package LunixREST\Server |
12 | 12 | */ |
13 | -interface Router |
|
14 | -{ |
|
13 | +interface Router { |
|
15 | 14 | /** |
16 | 15 | * @param APIRequest $request |
17 | 16 | * @return array|null|object |
@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | * Class DefaultRouter |
11 | 11 | * @package LunixREST\Server |
12 | 12 | */ |
13 | -class GenericRouter |
|
14 | -{ |
|
13 | +class GenericRouter { |
|
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"); |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use Psr\Http\Message\ResponseInterface; |
13 | 13 | use Psr\Http\Message\ServerRequestInterface; |
14 | 14 | |
15 | -class HTTPServer |
|
16 | -{ |
|
15 | +class HTTPServer { |
|
17 | 16 | /** |
18 | 17 | * @var Server |
19 | 18 | */ |
@@ -30,8 +29,7 @@ discard block |
||
30 | 29 | */ |
31 | 30 | //TODO: Add RequestLogger that we can pass through to log requests |
32 | 31 | //TODO: Add ErrorLogger to log errors (500s) |
33 | - public function __construct(Server $server, RequestFactory $requestFactory) |
|
34 | - { |
|
32 | + public function __construct(Server $server, RequestFactory $requestFactory) { |
|
35 | 33 | $this->server = $server; |
36 | 34 | $this->requestFactory = $requestFactory; |
37 | 35 | } |
@@ -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 |
@@ -7,8 +7,7 @@ |
||
7 | 7 | * Class APIResponse |
8 | 8 | * @package LunixREST\APIResponse |
9 | 9 | */ |
10 | -interface APIResponse |
|
11 | -{ |
|
10 | +interface APIResponse { |
|
12 | 11 | /** |
13 | 12 | * @return null|object|array |
14 | 13 | */ |
@@ -7,15 +7,13 @@ discard block |
||
7 | 7 | * Class JSONResponse |
8 | 8 | * @package LunixREST\APIResponse |
9 | 9 | */ |
10 | -class JSONResponse implements APIResponse |
|
11 | -{ |
|
10 | +class JSONResponse implements APIResponse { |
|
12 | 11 | /** |
13 | 12 | * @var null|object|array |
14 | 13 | */ |
15 | 14 | public $data; |
16 | 15 | |
17 | - public function __construct($data) |
|
18 | - { |
|
16 | + public function __construct($data) { |
|
19 | 17 | $this->data = $data; |
20 | 18 | } |
21 | 19 | |
@@ -35,8 +33,7 @@ discard block |
||
35 | 33 | /** |
36 | 34 | * @return null|object|array |
37 | 35 | */ |
38 | - public function getResponseData() |
|
39 | - { |
|
36 | + public function getResponseData() { |
|
40 | 37 | return $this->data; |
41 | 38 | } |
42 | 39 | } |