Total Complexity | 7 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | class FilesSingleton |
||
16 | { |
||
17 | protected static ?FilesSingleton $instance = null; |
||
18 | private ?IProcessFiles $filesAccessor = null; |
||
19 | |||
20 | 8 | public static function getInstance(): self |
|
21 | { |
||
22 | 8 | if (empty(static::$instance)) { |
|
23 | 1 | static::$instance = new self(); |
|
24 | } |
||
25 | 8 | return static::$instance; |
|
|
|||
26 | } |
||
27 | |||
28 | 1 | protected function __construct() |
|
30 | 1 | } |
|
31 | |||
32 | /** |
||
33 | * @codeCoverageIgnore why someone would run that?! |
||
34 | */ |
||
35 | private function __clone() |
||
36 | { |
||
37 | } |
||
38 | |||
39 | 7 | public function setFileAccessor(?IProcessFiles $files): void |
|
40 | { |
||
41 | 7 | $this->filesAccessor = $files; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @throws MapperException |
||
46 | * @return IProcessFiles |
||
47 | */ |
||
48 | 7 | public function getFilesAccessor(): IProcessFiles |
|
54 | } |
||
55 | } |
||
56 |