@@ -111,25 +111,25 @@ |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | - * Check if response is 4xx or 5xx error |
|
115 | - * |
|
116 | - * @return boolean |
|
117 | - */ |
|
118 | - public function isError() |
|
119 | - { |
|
120 | - return $this->isClientError() || $this->isServerError(); |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Get status code of response |
|
125 | - * |
|
126 | - * @return int |
|
127 | - */ |
|
128 | - protected function getResponseStatusCode() |
|
129 | - { |
|
114 | + * Check if response is 4xx or 5xx error |
|
115 | + * |
|
116 | + * @return boolean |
|
117 | + */ |
|
118 | + public function isError() |
|
119 | + { |
|
120 | + return $this->isClientError() || $this->isServerError(); |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Get status code of response |
|
125 | + * |
|
126 | + * @return int |
|
127 | + */ |
|
128 | + protected function getResponseStatusCode() |
|
129 | + { |
|
130 | 130 | $response = $this->getResponse(); |
131 | 131 | |
132 | 132 | return $response ? $response->getStatusCode() : 0; |
133 | - } |
|
133 | + } |
|
134 | 134 | } |
135 | 135 |
@@ -14,7 +14,8 @@ |
||
14 | 14 | * |
15 | 15 | * @return ResponseInterface |
16 | 16 | */ |
17 | - public function run() { |
|
17 | + public function run() |
|
18 | + { |
|
18 | 19 | $request = $this->getRequest(); |
19 | 20 | if (!$request) { |
20 | 21 | throw new \RuntimeException("Request object is not set for controller"); |
@@ -15,14 +15,14 @@ |
||
15 | 15 | * |
16 | 16 | * @return ServerRequestInterface |
17 | 17 | */ |
18 | - abstract public function getRequest(); |
|
19 | - |
|
20 | - /** |
|
21 | - * Get response. set for controller |
|
22 | - * |
|
23 | - * @return ResponseInterface |
|
24 | - */ |
|
25 | - abstract public function getResponse(); |
|
18 | + abstract public function getRequest(); |
|
19 | + |
|
20 | + /** |
|
21 | + * Get response. set for controller |
|
22 | + * |
|
23 | + * @return ResponseInterface |
|
24 | + */ |
|
25 | + abstract public function getResponse(); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Run the controller |
@@ -40,8 +40,7 @@ |
||
40 | 40 | |
41 | 41 | try { |
42 | 42 | $args = isset($route->args) ? |
43 | - $route->args : |
|
44 | - $this->getFunctionArgs($route, new \ReflectionMethod($this, $method)); |
|
43 | + $route->args : $this->getFunctionArgs($route, new \ReflectionMethod($this, $method)); |
|
45 | 44 | } catch (\RuntimeException $e) { |
46 | 45 | return $this->setResponseError(400, 'Bad Request'); |
47 | 46 | } |