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