| Total Complexity | 6 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class StorageSingleton |
||
| 16 | { |
||
| 17 | /** @var self|null */ |
||
| 18 | protected static $instance = null; |
||
| 19 | /** @var IStorage|null */ |
||
| 20 | private $storage = null; |
||
| 21 | |||
| 22 | 13 | public static function getInstance(): self |
|
| 23 | { |
||
| 24 | 13 | if (empty(static::$instance)) { |
|
| 25 | 1 | static::$instance = new self(); |
|
| 26 | } |
||
| 27 | 13 | return static::$instance; |
|
| 28 | } |
||
| 29 | |||
| 30 | 1 | protected function __construct() |
|
| 32 | 1 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * @codeCoverageIgnore why someone would run that?! |
||
| 36 | */ |
||
| 37 | private function __clone() |
||
| 39 | } |
||
| 40 | |||
| 41 | 13 | public function getStorage(): IStorage |
|
| 52 |