Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 83.33% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | trait SingletonTrait |
||
19 | { |
||
20 | /** @var static The instance. */ |
||
21 | private static $instance; |
||
22 | |||
23 | /** |
||
24 | * Protected constructor to prevent creating a new instance of the Singleton class from outside the object. |
||
25 | */ |
||
26 | 1 | protected function __construct() { } |
|
27 | |||
28 | /** |
||
29 | * Protected clone method to prevent cloning of the Singleton instance. |
||
30 | */ |
||
31 | protected function __clone() { } |
||
32 | |||
33 | /** |
||
34 | * Returns the only instance of the Singleton class. |
||
35 | * |
||
36 | * @return static the only instance of the Singleton class. |
||
37 | */ |
||
38 | 1 | public static function getInstance() |
|
45 | } |
||
46 | } |
||
47 |