Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
29 | function array_path_set(array $config, $dotPath, $value) |
||
30 | { |
||
31 | // Work backward from the last key, wrapping each key in an array |
||
32 | 3 | $replace = array_reduce( |
|
33 | 3 | array_reverse(explode('.', $dotPath)), |
|
34 | function ($value, $key) { |
||
35 | 3 | return [$key => $value]; |
|
36 | 3 | }, |
|
37 | $value |
||
38 | 3 | ); |
|
39 | |||
40 | // Overwrite the array with the replacement |
||
41 | 3 | return array_replace_recursive($config, $replace); |
|
42 | } |
||
43 |