Total Complexity | 11 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Coverage | 75% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | class FileManager |
||
10 | { |
||
11 | /** |
||
12 | * @param DefinitionsCollection $definitionCollection |
||
13 | * @param null $path |
||
|
|||
14 | */ |
||
15 | 3 | public static function write($definitionCollection, $path = null) |
|
16 | { |
||
17 | 3 | $path = $path ? $path : static::filePath(); |
|
18 | 3 | $content = '<?php return ' . var_export($definitionCollection->all(), true) . ';'; |
|
19 | 3 | file_put_contents($path, $content); |
|
20 | 3 | } |
|
21 | |||
22 | /** |
||
23 | * @param DefinitionsCollection $definitionCollection |
||
24 | * @param null $path |
||
25 | */ |
||
26 | 2 | public static function read($definitionCollection, $path = null) |
|
27 | { |
||
28 | 2 | $path = $path ? $path : static::filePath(); |
|
29 | /** @noinspection PhpIncludeInspection */ |
||
30 | 2 | $items = require $path; |
|
31 | 2 | $definitionCollection->replace($items); |
|
32 | 2 | } |
|
33 | |||
34 | /** |
||
35 | * @param null $path |
||
36 | */ |
||
37 | public static function empty($path = null) |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return bool |
||
46 | */ |
||
47 | 1 | public static function hasCacheFile() |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | */ |
||
56 | 3 | public static function filePath() |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | 3 | public static function filePathBase() |
|
71 |