Total Complexity | 5 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 90.91% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class FactoryInstances |
||
15 | { |
||
16 | /** @var FactoryInstances|null */ |
||
17 | protected static $instance = null; |
||
18 | /** @var Factory */ |
||
19 | protected $factory = null; |
||
20 | |||
21 | 1 | public static function init(?Interfaces\IStTranslations $lang = null): void |
|
22 | { |
||
23 | 1 | static::$instance = new self($lang); |
|
24 | 1 | } |
|
25 | |||
26 | 1 | public static function getInstance(): Factory |
|
27 | { |
||
28 | 1 | if (empty(static::$instance)) { |
|
29 | 1 | static::$instance = new self(); |
|
30 | } |
||
31 | 1 | return static::$instance->factory; |
|
32 | } |
||
33 | |||
34 | 1 | protected function __construct(?Interfaces\IStTranslations $lang = null) |
|
37 | 1 | } |
|
38 | |||
39 | /** |
||
40 | * @codeCoverageIgnore singleton |
||
41 | */ |
||
42 | private function __clone() |
||
47 |