| Conditions | 2 |
| Paths | 5 |
| Total Lines | 13 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | 10 | public static function factory(DynamoDbException $ex): Exception |
|
| 26 | { |
||
| 27 | try { |
||
| 28 | 10 | $className = sprintf( |
|
| 29 | 10 | '%s\%s', |
|
| 30 | 10 | '\Guillermoandrae\DynamoDb\Exception', |
|
| 31 | 10 | $ex->getAwsErrorCode() |
|
| 32 | ); |
||
| 33 | 10 | $reflectionClass = new ReflectionClass($className); |
|
| 34 | 9 | $args = [sprintf('An error has occurred => %s', $ex->getAwsErrorMessage()), $ex->getCode()]; |
|
| 35 | 9 | return $reflectionClass->newInstanceArgs($args); |
|
| 36 | 1 | } catch (ReflectionException $ex) { |
|
| 37 | 1 | return new Exception($ex->getMessage(), $ex->getCode()); |
|
| 38 | } |
||
| 41 |