| 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=[]){ | 
            ||
| 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=[])  | 
            ||
| 34 | }  | 
            ||
| 35 | |||
| 36 | /**  | 
            ||
| 37 | * Description: __callStatic  | 
            ||
| 38 | * @param $gateway  | 
            ||
| 39 | * @param array $config  | 
            ||
| 40 | * @return Singleton|null  | 
            ||
| 41 | *@author: JiaMeng <[email protected]>  | 
            ||
| 42 | * Updater:  | 
            ||
| 43 | */  | 
            ||
| 44 | public static function __callStatic($gateway, array $config=[])  | 
            ||
| 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.