Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | 1 | private static function createClientException(GuzzleHttpRequestException $exception) |
|
34 | { |
||
35 | $exceptionArray = array( |
||
36 | 1 | 400 => 'BadRequest', |
|
37 | 1 | 401 => 'Unauthorized', |
|
38 | 1 | 403 => 'Forbidden', |
|
39 | 1 | 404 => 'NotFound', |
|
40 | 1 | 405 => 'MethodNotAllowed', |
|
41 | 406 => 'NotAcceptable' |
||
42 | 1 | ); |
|
43 | |||
44 | 1 | foreach ($exceptionArray as $item => $value) { |
|
45 | 1 | if ($item === $exception->getCode()) { |
|
46 | 1 | $exceptionName = __NAMESPACE__ . '\Client\\' . $value . 'Exception'; |
|
47 | 1 | return new $exceptionName($exception); |
|
48 | } |
||
49 | 1 | } |
|
50 | |||
51 | 1 | return new RequestException($exception); |
|
52 | } |
||
53 | } |
||
54 |