Total Complexity | 4 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 9 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | abstract class OAuth |
||
15 | { |
||
16 | |||
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 | } |
||
30 | |||
31 | public static function __callStatic($gateway, $config) |
||
34 | } |
||
35 | |||
37 |