| Total Complexity | 10 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 55% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class Params extends Config |
||
| 9 | { |
||
| 10 | protected function calcValues(array $sources): array |
||
| 11 | { |
||
| 12 | return $this->pushEnvVars(parent::calcValues($sources)); |
||
| 13 | } |
||
| 14 | |||
| 15 | protected function pushEnvVars(array $data): array |
||
| 24 | } |
||
| 25 | |||
| 26 | 1 | public static function pushValues(array $data, array $values, string $prefix = null) |
|
| 27 | { |
||
| 28 | 1 | foreach ($data as $key => &$value) { |
|
| 29 | 1 | $subkey = $prefix===null ? $key : "${prefix}_$key"; |
|
| 30 | |||
| 31 | 1 | $envkey = self::getEnvKey($subkey); |
|
| 32 | 1 | if (isset($values[$envkey])) { |
|
| 33 | 1 | $value = $values[$envkey]; |
|
| 34 | 1 | } elseif (is_array($value)) { |
|
| 35 | 1 | $value = self::pushValues($value, $values, $subkey); |
|
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | 1 | return $data; |
|
| 40 | } |
||
| 41 | |||
| 42 | 1 | private static function getEnvKey(string $key): string |
|
| 45 | } |
||
| 46 | |||
| 47 | protected function paramsRequired(): bool |
||
| 50 | } |
||
| 51 | } |
||
| 52 |