Conditions | 7 |
Paths | 5 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | protected function pushEnvVars(array $vars): array |
||
16 | { |
||
17 | if (empty($vars)) { |
||
18 | return []; |
||
19 | } |
||
20 | |||
21 | $env = $this->builder->getConfig('envs')->getValues(); |
||
22 | |||
23 | foreach ($vars as $key => &$value) { |
||
24 | if (is_array($value)) { |
||
25 | foreach (array_keys($value) as $subkey) { |
||
26 | $envKey = $this->getEnvKey($key . '_' . $subkey); |
||
27 | if (isset($env[$envKey])) { |
||
28 | $value[$subkey] = $env[$envKey]; |
||
29 | } |
||
30 | } |
||
31 | } else { |
||
32 | $envKey = $this->getEnvKey($key); |
||
33 | if (isset($env[$envKey])) { |
||
34 | $vars[$key] = $env[$envKey]; |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | |||
39 | return $vars; |
||
40 | } |
||
52 |