@@ -48,12 +48,12 @@ |
||
48 | 48 | $parsedHeaders = $this->headerParser->parse($serverRequest->getHeaders()); |
49 | 49 | |
50 | 50 | $urlQueryData = []; |
51 | - if($urlQueryString = $parsedURL->getQueryString()) { |
|
51 | + if ($urlQueryString = $parsedURL->getQueryString()) { |
|
52 | 52 | parse_str($urlQueryString, $urlQueryData); |
53 | 53 | } |
54 | 54 | |
55 | 55 | $apiKey = $parsedURL->getAPIKey(); |
56 | - if($apiKey === null) { |
|
56 | + if ($apiKey === null) { |
|
57 | 57 | $apiKey = $parsedHeaders->getAPIKey(); |
58 | 58 | } |
59 | 59 |
@@ -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 | } |
@@ -10,8 +10,7 @@ |
||
10 | 10 | * Class JSONHTTPServer |
11 | 11 | * @package LunixREST |
12 | 12 | */ |
13 | -class JSONHTTPServer extends HTTPServer |
|
14 | -{ |
|
13 | +class JSONHTTPServer extends HTTPServer { |
|
15 | 14 | /** |
16 | 15 | * @param ServerRequestInterface $serverRequest |
17 | 16 | * @param ResponseInterface $response |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } catch (InvalidAPIKeyException | AccessDeniedException $e) { |
103 | 103 | $this->logCaughtThrowableResultingInHTTPCode(403, $e, LogLevel::NOTICE); |
104 | 104 | return $response->withStatus(403, "Access Denied"); |
105 | - } catch (ElementConflictException $e) { |
|
105 | + } catch (ElementConflictException $e) { |
|
106 | 106 | $this->logCaughtThrowableResultingInHTTPCode(409, $e, LogLevel::NOTICE); |
107 | 107 | return $response->withStatus(409, "Conflict"); |
108 | 108 | } catch (ThrottleLimitExceededException $e) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $body = $response->getBody(); |
138 | - while(!$body->eof()) { |
|
138 | + while (!$body->eof()) { |
|
139 | 139 | echo $body->read(1024); |
140 | 140 | } |
141 | 141 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * Class HTTPServer |
26 | 26 | * @package LunixREST |
27 | 27 | */ |
28 | -class HTTPServer |
|
29 | -{ |
|
28 | +class HTTPServer { |
|
30 | 29 | use LoggerAwareTrait; |
31 | 30 | |
32 | 31 | /** |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * @param RequestFactory $requestFactory |
45 | 44 | * @param LoggerInterface $logger |
46 | 45 | */ |
47 | - public function __construct(Server $server, RequestFactory $requestFactory, LoggerInterface $logger) |
|
48 | - { |
|
46 | + public function __construct(Server $server, RequestFactory $requestFactory, LoggerInterface $logger) { |
|
49 | 47 | $this->server = $server; |
50 | 48 | $this->requestFactory = $requestFactory; |
51 | 49 | $this->logger = $logger; |
@@ -81,8 +79,7 @@ discard block |
||
81 | 79 | * @param ResponseInterface $response |
82 | 80 | * @return ResponseInterface |
83 | 81 | */ |
84 | - protected function handleAPIRequest(APIRequest $APIRequest, ResponseInterface $response) |
|
85 | - { |
|
82 | + protected function handleAPIRequest(APIRequest $APIRequest, ResponseInterface $response) { |
|
86 | 83 | try { |
87 | 84 | $APIResponse = $this->server->handleRequest($APIRequest); |
88 | 85 | |
@@ -103,7 +100,7 @@ discard block |
||
103 | 100 | } catch (InvalidAPIKeyException | AccessDeniedException $e) { |
104 | 101 | $this->logCaughtThrowableResultingInHTTPCode(403, $e, LogLevel::NOTICE); |
105 | 102 | return $response->withStatus(403, "Access Denied"); |
106 | - } catch (ElementConflictException $e) { |
|
103 | + } catch (ElementConflictException $e) { |
|
107 | 104 | $this->logCaughtThrowableResultingInHTTPCode(409, $e, LogLevel::NOTICE); |
108 | 105 | return $response->withStatus(409, "Conflict"); |
109 | 106 | } catch (ThrottleLimitExceededException $e) { |