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