Conditions | 3 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | 2 | public function __invoke($e, Request $request, Response $response) |
|
22 | { |
||
23 | 2 | $status = $response->getStatusCode(); |
|
24 | 2 | $responsePhrase = $status < 400 ? 'Internal Server Error' : $response->getReasonPhrase(); |
|
25 | 2 | $status = $status < 400 ? self::STATUS_INTERNAL_SERVER_ERROR : $status; |
|
26 | |||
27 | 2 | return new JsonResponse([ |
|
28 | 2 | 'error' => $this->responsePhraseToCode($responsePhrase), |
|
29 | 2 | 'message' => $responsePhrase, |
|
30 | 2 | ], $status); |
|
31 | } |
||
32 | |||
42 |