Conditions | 6 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function mergeContexts(array $context1, array $context2): array |
||
17 | { |
||
18 | $finalContext = $context1; |
||
19 | foreach ($context2 as $key => $value) { |
||
20 | if (is_numeric($key)) { |
||
21 | $finalContext[] = $value; |
||
22 | continue; |
||
23 | } |
||
24 | |||
25 | if (isset($finalContext[$key]) && is_array($finalContext[$key]) && is_array($value)) { |
||
26 | $finalContext[$key] = $this->mergeContexts($finalContext[$key], $value); |
||
27 | continue; |
||
28 | } |
||
29 | $finalContext[$key] = $value; |
||
30 | } |
||
31 | return $finalContext; |
||
32 | } |
||
33 | } |