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