Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
19 | 4 | public static function create(string $name): AdapterInterface |
|
20 | { |
||
21 | 4 | $class = Shipping::getClassName($name); |
|
22 | 4 | if (! Shipping::canCreate($class)) { |
|
23 | // throw new RuntimeException("Class '$class' not found"); |
||
24 | 2 | throw new RuntimeException("Invalid or non existing adapter"); |
|
25 | } |
||
26 | |||
27 | // this should be an adapter instance |
||
28 | 2 | return new $class(); |
|
29 | } |
||
53 |