Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
21 | protected function loadFile($filePath) |
||
22 | { |
||
23 | $yml = array(); |
||
24 | $dirname = dirname($filePath); |
||
25 | $yaml = new \Symfony\Component\Yaml\Yaml(); |
||
26 | $res = $yaml->parse($filePath); |
||
27 | |||
28 | foreach($res as $key => $value) { |
||
29 | if ($key == 'include') { |
||
30 | foreach($value as $file) { |
||
31 | $file = preg_replace_callback('`\${env\.([^}]+)}`i', function($matches) { return getenv($matches[1]); }, $file); |
||
32 | $subYml = $this->loadFile($dirname . '/' . $file); |
||
33 | $yml = Arrays::mergeRecursiveUnique($yml, $subYml); |
||
34 | } |
||
35 | } |
||
36 | else { |
||
37 | $yml = Arrays::mergeRecursiveUnique($yml, array($key => $res[$key])); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | return $yml; |
||
42 | } |
||
43 | |||
51 |