Total Complexity | 6 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait Singleton |
||
8 | { |
||
9 | private $config; |
||
10 | |||
11 | /** |
||
12 | * @var null |
||
13 | */ |
||
14 | private static $instance = null; |
||
15 | |||
16 | public function __construct($config=null){ |
||
17 | $this->config = $config; |
||
18 | } |
||
19 | |||
20 | private function __clone(){} |
||
21 | |||
22 | public function __sleep(): array |
||
23 | { |
||
24 | //重写__sleep方法,将返回置空,防止序列化反序列化获得新的对象 |
||
25 | return []; |
||
26 | } |
||
27 | |||
28 | protected static function init($gateway, $config=null) |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Description: __callStatic |
||
38 | * @author: JiaMeng <[email protected]> |
||
39 | * Updater: |
||
40 | * @param $gateway |
||
41 | * @param $config |
||
42 | * @return mixed |
||
43 | */ |
||
44 | public static function __callStatic($gateway, $config=null) |
||
47 | } |
||
48 | |||
49 | } |
||
50 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.