| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function convertToException($fault) |
||
| 23 | { |
||
| 24 | $errorClassName = isset($fault->{'detail'}->{'errorCode'}) ? $fault->{'detail'}->{'errorCode'} : 'Server'; |
||
| 25 | $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 | if (!class_exists($errorClassFQ)) { |
||
| 29 | throw new ServerException("Could not convert errorCode: '$errorClassName'"); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** @var WebserviceException $exception */ |
||
| 33 | return new $errorClassFQ($fault->getMessage(), $fault->getCode()); |
||
| 34 | } |
||
| 35 | |||
| 57 |