Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | public static function parse($fileContent) |
||
10 | { |
||
11 | preg_match_all('^\${(.*)}^', $fileContent, $matches); |
||
12 | |||
13 | foreach ($matches[1] as $varName) { |
||
14 | if (!getenv($varName)) { |
||
15 | throw new \RuntimeException("The mandatory env variable (" . $varName . ") from the config file was not set."); |
||
16 | } |
||
17 | |||
18 | $fileContent = str_replace('${' . $varName . '}', getenv($varName), $fileContent); |
||
19 | } |
||
20 | return Yaml::parse($fileContent); |
||
21 | } |
||
22 | |||
23 | } |