| 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 |
||
| 12 | 8 | public static function factory(DynamoDbException $ex): Exception |
|
| 13 | { |
||
| 14 | try { |
||
| 15 | 8 | $className = sprintf( |
|
| 16 | 8 | '%s\%s', |
|
| 17 | 8 | '\Guillermoandrae\DynamoDb\Exception', |
|
| 18 | 8 | $ex->getAwsErrorCode() |
|
| 19 | ); |
||
| 20 | 8 | $reflectionClass = new ReflectionClass($className); |
|
| 21 | 7 | $args = [sprintf('An error has occurred: %s', $ex->getAwsErrorMessage()), $ex->getCode()]; |
|
| 22 | 7 | return $reflectionClass->newInstanceArgs($args); |
|
| 23 | 1 | } catch (ReflectionException $ex) { |
|
| 24 | 1 | return new Exception($ex->getMessage(), $ex->getCode()); |
|
| 25 | } |
||
| 28 |