| Conditions | 7 |
| Paths | 7 |
| Total Lines | 19 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function handleResponse(ResponseInterface $response): void |
||
| 23 | { |
||
| 24 | $body = (string)$response->getBody(); |
||
| 25 | |||
| 26 | switch ($response->getStatusCode()) { |
||
| 27 | case 400: |
||
| 28 | throw new DomainExceptions\ValidationException($body); |
||
| 29 | case 401: |
||
| 30 | throw new DomainExceptions\UnauthorizedException($body); |
||
| 31 | case 403: |
||
| 32 | throw new DomainExceptions\ForbiddenException(); |
||
| 33 | case 404: |
||
| 34 | throw new DomainExceptions\NotFoundException(); |
||
| 35 | case 406: |
||
| 36 | throw new DomainExceptions\ClientException('Wrong Accept headers'); |
||
| 37 | case 500: |
||
| 38 | throw new DomainExceptions\ServerException(); |
||
| 39 | default: |
||
| 40 | throw new DomainExceptions\UnknownErrorException(); |
||
| 41 | } |
||
| 44 |