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