Total Complexity | 2 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | final class YamlAdapter extends \Nette\Di\Config\Adapter |
||
30 | { |
||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | public function load(string $file): array |
||
35 | { |
||
36 | // So yaml syntax could work properly |
||
37 | $contents = \str_replace( |
||
38 | ['~', '\'false\'', '\'true\'', '"false"', '"true"'], |
||
39 | ['null', 'false', 'true', 'false', 'true'], |
||
40 | FileSystem::read($file) |
||
41 | ); |
||
42 | |||
43 | return (new NeonAdapter())->process((array) Neon\Neon::decode($contents)); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Generates configuration in NEON format. |
||
48 | */ |
||
49 | public function dump(array $data): string |
||
52 | } |
||
53 | } |
||
54 |