Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | protected static function init($gateway, $config = null) |
||
18 | { |
||
19 | $gateway = Str::uFirst($gateway); |
||
20 | $class = __NAMESPACE__ . '\\Gateways\\' . $gateway; |
||
21 | if (class_exists($class)) { |
||
22 | $app = new $class($config); |
||
23 | if ($app instanceof GatewayInterface) { |
||
24 | return $app; |
||
25 | } |
||
26 | throw new \Exception("第三方登录基类 [$gateway] 必须继承抽象类 [GatewayInterface]"); |
||
27 | } |
||
28 | throw new \Exception("第三方登录基类 [$gateway] 不存在"); |
||
29 | } |
||
37 |