| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function getResponse($url) |
||
| 31 | { |
||
| 32 | try { |
||
| 33 | return $this->guzzleClient->request('GET', $url); |
||
| 34 | } catch (RequestException $e) { |
||
| 35 | if (is_null($e->getResponse())) { |
||
| 36 | throw new HttpErrorException; |
||
| 37 | } |
||
| 38 | switch ((int) $e->getResponse()->getStatusCode()) { |
||
| 39 | case 404: |
||
| 40 | throw new NotFoundException($e->getMessage()); |
||
| 41 | default: |
||
| 42 | throw new ServerErrorException($e->getMessage()); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 |