@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | use Api\Config\ConfigProxy; |
4 | -use Api\Controller\Factory as ControllerFactory; |
|
5 | 4 | use Api\ErrorHandler; |
6 | 5 | use Monolog\Logger; |
7 | 6 | use Monolog\Handler\StreamHandler; |
@@ -16,5 +16,5 @@ |
||
16 | 16 | $errorHandler = new ErrorHandler($logger); |
17 | 17 | if ($environment == 'production') { |
18 | 18 | set_error_handler([$errorHandler, "errorHandler"]); |
19 | - set_exception_handler([$errorHandler,"exceptionHandler"]); |
|
19 | + set_exception_handler([$errorHandler, "exceptionHandler"]); |
|
20 | 20 | } |
@@ -11,6 +11,9 @@ |
||
11 | 11 | $this->logger = $logger; |
12 | 12 | } |
13 | 13 | |
14 | + /** |
|
15 | + * @param string $message |
|
16 | + */ |
|
14 | 17 | private function buildErrorMessage($message) { |
15 | 18 | header('Content-Type: application/json'); |
16 | 19 | die(json_encode(['error' => $message])); |
@@ -19,10 +19,10 @@ |
||
19 | 19 | public function errorHandler($level, $message, $file) { |
20 | 20 | $this->logger->addWarning($message); |
21 | 21 | $this->buildErrorMessage('Error occur.'); |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | 24 | public function exceptionHandler($exception) { |
25 | 25 | $this->logger->addWarning($exception->getMessage()); |
26 | 26 | $this->buildErrorMessage('Error occur.'); |
27 | - } |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | break; |
24 | 24 | } |
25 | 25 | |
26 | - if ( ! class_exists($className)) { |
|
26 | + if (!class_exists($className)) { |
|
27 | 27 | throw new \Exception("Strategy {$className} not found"); |
28 | 28 | } |
29 | 29 |