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