@@ -6,8 +6,7 @@ discard block |
||
6 | 6 | * Class ParsedHeaders |
7 | 7 | * @package LunixREST\APIRequest\HeaderParser |
8 | 8 | */ |
9 | -class ParsedHeaders |
|
10 | -{ |
|
9 | +class ParsedHeaders { |
|
11 | 10 | /** |
12 | 11 | * @var array |
13 | 12 | */ |
@@ -27,8 +26,7 @@ discard block |
||
27 | 26 | * @param array $acceptableMIMETypes |
28 | 27 | * @param $APIKey |
29 | 28 | */ |
30 | - public function __construct($contentType, array $acceptableMIMETypes, $APIKey) |
|
31 | - { |
|
29 | + public function __construct($contentType, array $acceptableMIMETypes, $APIKey) { |
|
32 | 30 | $this->contentType = $contentType; |
33 | 31 | $this->acceptableMIMETypes = $acceptableMIMETypes; |
34 | 32 | $this->APIKey = $APIKey; |
@@ -37,8 +35,7 @@ discard block |
||
37 | 35 | /** |
38 | 36 | * @return mixed |
39 | 37 | */ |
40 | - public function getContentType() |
|
41 | - { |
|
38 | + public function getContentType() { |
|
42 | 39 | return $this->contentType; |
43 | 40 | } |
44 | 41 | |
@@ -53,8 +50,7 @@ discard block |
||
53 | 50 | /** |
54 | 51 | * @return mixed |
55 | 52 | */ |
56 | - public function getAPIKey() |
|
57 | - { |
|
53 | + public function getAPIKey() { |
|
58 | 54 | return $this->APIKey; |
59 | 55 | } |
60 | 56 | } |
@@ -6,8 +6,7 @@ |
||
6 | 6 | * Interface HeaderParser |
7 | 7 | * @package LunixREST\APIRequest\HeaderParser |
8 | 8 | */ |
9 | -interface HeaderParser |
|
10 | -{ |
|
9 | +interface HeaderParser { |
|
11 | 10 | /** |
12 | 11 | * @param array $headers |
13 | 12 | * @return ParsedHeaders |
@@ -6,7 +6,6 @@ |
||
6 | 6 | * Class ElementNotFoundException |
7 | 7 | * @package LunixREST\Endpoint\Exceptions |
8 | 8 | */ |
9 | -class ElementNotFoundException extends \Exception |
|
10 | -{ |
|
9 | +class ElementNotFoundException extends \Exception { |
|
11 | 10 | |
12 | 11 | } |
@@ -6,7 +6,6 @@ |
||
6 | 6 | * Class InvalidRequestException |
7 | 7 | * @package LunixREST\Endpoint\Exceptions |
8 | 8 | */ |
9 | -class InvalidRequestException extends \Exception |
|
10 | -{ |
|
9 | +class InvalidRequestException extends \Exception { |
|
11 | 10 | |
12 | 11 | } |
@@ -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 | } |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * Class HTTPServer |
25 | 25 | * @package LunixREST\Server |
26 | 26 | */ |
27 | -class HTTPServer |
|
28 | -{ |
|
27 | +class HTTPServer { |
|
29 | 28 | use LoggerAwareTrait; |
30 | 29 | |
31 | 30 | /** |
@@ -43,8 +42,7 @@ discard block |
||
43 | 42 | * @param RequestFactory $requestFactory |
44 | 43 | * @param LoggerInterface $logger |
45 | 44 | */ |
46 | - public function __construct(Server $server, RequestFactory $requestFactory, LoggerInterface $logger) |
|
47 | - { |
|
45 | + public function __construct(Server $server, RequestFactory $requestFactory, LoggerInterface $logger) { |
|
48 | 46 | $this->server = $server; |
49 | 47 | $this->requestFactory = $requestFactory; |
50 | 48 | $this->logger = $logger; |
@@ -80,8 +78,7 @@ discard block |
||
80 | 78 | * @param ResponseInterface $response |
81 | 79 | * @return ResponseInterface |
82 | 80 | */ |
83 | - protected function handleAPIRequest(APIRequest $APIRequest, ResponseInterface $response) |
|
84 | - { |
|
81 | + protected function handleAPIRequest(APIRequest $APIRequest, ResponseInterface $response) { |
|
85 | 82 | try { |
86 | 83 | $APIResponse = $this->server->handleRequest($APIRequest); |
87 | 84 | |
@@ -102,7 +99,7 @@ discard block |
||
102 | 99 | } catch (InvalidAPIKeyException | AccessDeniedException $e) { |
103 | 100 | $this->logCaughtThrowableResultingInHTTPCode(403, $e, LogLevel::NOTICE); |
104 | 101 | return $response->withStatus(403, "Access Denied"); |
105 | - } catch (ElementConflictException $e) { |
|
102 | + } catch (ElementConflictException $e) { |
|
106 | 103 | $this->logCaughtThrowableResultingInHTTPCode(409, $e, LogLevel::NOTICE); |
107 | 104 | return $response->withStatus(409, "Conflict"); |
108 | 105 | } catch (ThrottleLimitExceededException $e) { |
@@ -6,7 +6,6 @@ |
||
6 | 6 | * Class ElementConflictException |
7 | 7 | * @package LunixREST\Endpoint\Exceptions |
8 | 8 | */ |
9 | -class ElementConflictException extends \Exception |
|
10 | -{ |
|
9 | +class ElementConflictException extends \Exception { |
|
11 | 10 | |
12 | 11 | } |