Total Complexity | 7 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 86.67% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | class FilesSingleton |
||
16 | { |
||
17 | /** @var self|null */ |
||
18 | protected static $instance = null; |
||
19 | /** @var IProcessFiles|null */ |
||
20 | private $filesAccessor = null; |
||
21 | |||
22 | 8 | public static function getInstance(): self |
|
23 | { |
||
24 | 8 | if (empty(static::$instance)) { |
|
25 | 1 | static::$instance = new self(); |
|
26 | } |
||
27 | 8 | 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() |
||
38 | { |
||
39 | } |
||
40 | |||
41 | 7 | public function setFileAccessor(?IProcessFiles $files): void |
|
42 | { |
||
43 | 7 | $this->filesAccessor = $files; |
|
44 | 7 | } |
|
45 | |||
46 | /** |
||
47 | * @throws MapperException |
||
48 | * @return IProcessFiles |
||
49 | */ |
||
50 | 7 | public function getFilesAccessor(): IProcessFiles |
|
56 | } |
||
57 | } |
||
58 |