| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | * {@inheritDoc} |
||
| 21 | */ |
||
| 22 | 17 | public function process(RequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 23 | { |
||
| 24 | 17 | $response = $handler->handle($request); |
|
| 25 | |||
| 26 | 17 | if ($response->getStatusCode() >= 500) { |
|
| 27 | 2 | throw new UnavailableException($response->getReasonPhrase()); |
|
| 28 | } |
||
| 29 | |||
| 30 | 15 | if ($response->getStatusCode() === 404) { |
|
| 31 | 1 | throw new NotFoundException('No results found'); |
|
| 32 | } |
||
| 33 | |||
| 34 | 14 | if ($response->getStatusCode() === 401) { |
|
| 35 | 1 | throw new AuthorizationException($response->getReasonPhrase()); |
|
| 36 | } |
||
| 37 | |||
| 38 | 13 | if ($response->getStatusCode() >= 400) { |
|
| 39 | 1 | throw new ResponseException($response->getReasonPhrase()); |
|
| 45 |