Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.1406 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
41 | 2 | public static function create($name, array $options = []) |
|
42 | { |
||
43 | 2 | $gateway = self::GATEWAY_NAMESPACE . $name; |
|
44 | |||
45 | 2 | if (class_exists($gateway)) { |
|
46 | 1 | return new $gateway($options); |
|
47 | } |
||
48 | |||
49 | 1 | if (array_key_exists($name, self::$gateways)) { |
|
50 | $gateway = self::$gateways[$name]; |
||
51 | |||
52 | return new $gateway($options); |
||
53 | } |
||
54 | |||
55 | 1 | throw GatewayException::invalidGatewayName($name); |
|
56 | } |
||
58 |