Conditions | 2 |
Paths | 5 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2.032 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 9 | public static function factory(DynamoDbException $ex): Exception |
|
13 | { |
||
14 | try { |
||
15 | 9 | $className = sprintf( |
|
16 | 9 | '%s\%s', |
|
17 | 9 | '\Guillermoandrae\DynamoDb\Exception', |
|
18 | 9 | $ex->getAwsErrorCode() |
|
19 | ); |
||
20 | 9 | $reflectionClass = new ReflectionClass($className); |
|
21 | 9 | $args = [sprintf('An error has occurred => %s', $ex->getAwsErrorMessage()), $ex->getCode()]; |
|
22 | 9 | return $reflectionClass->newInstanceArgs($args); |
|
23 | } catch (ReflectionException $ex) { |
||
24 | return new Exception($ex->getMessage(), $ex->getCode()); |
||
25 | } |
||
28 |