| Total Complexity | 6 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class Singleton |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var self |
||
| 14 | */ |
||
| 15 | private static $instance; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @return self |
||
| 19 | */ |
||
| 20 | public static function getInstance(): self |
||
| 21 | { |
||
| 22 | if (!self::$instance instanceof self) { |
||
|
|
|||
| 23 | self::$instance = new self(); |
||
| 24 | } |
||
| 25 | |||
| 26 | return self::$instance; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * SingletonTrait constructor. |
||
| 31 | */ |
||
| 32 | public function __construct() |
||
| 33 | { |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @codeCoverageIgnore |
||
| 38 | */ |
||
| 39 | public function __sleep() |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @codeCoverageIgnore |
||
| 45 | */ |
||
| 46 | public function __wakeup() |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @codeCoverageIgnore |
||
| 52 | */ |
||
| 53 | public function __clone() |
||
| 57 |