Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
22 | 20 | public function convertToException($fault) |
|
23 | { |
||
24 | 20 | $errorClassName = isset($fault->{'detail'}->{'errorcode'}) ? $fault->{'detail'}->{'errorcode'} : 'Server'; |
|
25 | 20 | $errorClassFQ = 'WebservicesNl\Common\Exception\\' . str_replace('.', '\\', $errorClassName) . 'Exception'; |
|
26 | |||
27 | // should we throw an error about throwing an error? or just create a default error? |
||
28 | 20 | if (!class_exists($errorClassFQ)) { |
|
29 | 1 | throw new ServerException("Could not convert errorCode: '$errorClassName'"); |
|
30 | } |
||
31 | |||
32 | /** @var WebserviceException $exception */ |
||
33 | 19 | return new $errorClassFQ($fault->getMessage(), $fault->getCode()); |
|
34 | } |
||
35 | |||
57 |