Total Complexity | 6 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 81.82% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait Singleton |
||
6 | { |
||
7 | protected function __construct() |
||
9 | } |
||
10 | |||
11 | /** |
||
12 | * @throws SingletonException |
||
13 | */ |
||
14 | 1 | final public function __clone() |
|
15 | { |
||
16 | 1 | throw new SingletonException('You can not clone a singleton.'); |
|
17 | } |
||
18 | |||
19 | /** |
||
20 | * @throws SingletonException |
||
21 | */ |
||
22 | 1 | final public function __sleep() |
|
23 | { |
||
24 | 1 | throw new SingletonException('You can not serialize a singleton.'); |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * @throws SingletonException |
||
29 | */ |
||
30 | final public function __wakeup() |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return static |
||
37 | */ |
||
38 | 3 | public static function getInstance() |
|
48 | } |
||
49 | |||
50 | } |
||
51 |