Total Complexity | 7 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class Php extends Filesystem |
||
10 | { |
||
11 | public function load(string $path): array |
||
12 | { |
||
13 | if ($this->doesntExists($path)) { |
||
14 | $this->log('File not found: ' . $path); |
||
15 | |||
16 | return []; |
||
17 | } |
||
18 | |||
19 | $this->log('Loading data from a file: ' . $path); |
||
20 | |||
21 | $items = Pretty::make()->load($path); |
||
22 | |||
23 | return $this->correctValues($items); |
||
24 | } |
||
25 | |||
26 | public function store(string $path, array $content) |
||
27 | { |
||
28 | $this->log('Saving an array to a file: ' . $path); |
||
29 | |||
30 | $service = Formatter::make(); |
||
31 | |||
32 | $this->setCase($service); |
||
33 | $this->setAlignment($service); |
||
34 | |||
35 | Pretty::make($service->raw($content))->store($path); |
||
36 | } |
||
37 | |||
38 | protected function isAlignment(): bool |
||
41 | } |
||
42 | |||
43 | protected function setCase(Formatter $formatter): void |
||
44 | { |
||
45 | $this->log('Setting the key conversion label.'); |
||
46 | |||
47 | $formatter->setCase(Config::getCase()); |
||
48 | } |
||
49 | |||
50 | protected function setAlignment(Formatter $formatter): void |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 |