Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | private function exception(): void |
||
35 | { |
||
36 | if ($this->response->getStatusCode() === Response::HTTP_FORBIDDEN) { |
||
37 | throw ServiceException::invalidApiKey(); |
||
38 | } |
||
39 | |||
40 | if ($this->response->getStatusCode() === Response::HTTP_UNPROCESSABLE_ENTITY) { |
||
41 | throw ServiceException::invalidPayload(); |
||
42 | } |
||
43 | |||
44 | if ($this->response->getStatusCode() === Response::HTTP_TOO_MANY_REQUESTS) { |
||
45 | throw ServiceException::rateLimit(); |
||
46 | } |
||
47 | |||
48 | if ($this->response->getStatusCode() === Response::HTTP_INTERNAL_SERVER_ERROR) { |
||
49 | throw ServiceException::serverError(); |
||
50 | } |
||
51 | |||
52 | throw ServiceException::generic(); |
||
53 | } |
||
55 |