| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class SingletonsPool |
||
| 17 | { |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | protected static $instances = []; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $instanceName |
||
| 26 | * @return mixed |
||
| 27 | */ |
||
| 28 | public static function getInstance(string $instanceName): self |
||
| 29 | { |
||
| 30 | if (!array_key_exists($instanceName, static::$instances)){ |
||
| 31 | static::$instances[$instanceName] = new static; |
||
| 32 | } |
||
| 33 | |||
| 34 | return static::$instances[$instanceName]; |
||
| 35 | } |
||
| 36 | |||
| 37 | public function __construct() |
||
| 38 | { |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @codeCoverageIgnore |
||
| 43 | */ |
||
| 44 | public function __sleep() |
||
| 45 | { |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @codeCoverageIgnore |
||
| 50 | */ |
||
| 51 | public function __wakeup() |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @codeCoverageIgnore |
||
| 57 | */ |
||
| 58 | public function __clone() |
||
| 60 | } |
||
| 61 | } |
||
| 62 |