Conditions | 2 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
10 | function array_path(array $config, string $dotPath, $default = null) |
||
11 | { |
||
12 | // Working from the first key, descend into the array until nothing is found |
||
13 | 3 | return array_reduce( |
|
14 | 3 | explode('.', $dotPath), |
|
15 | function ($config, $key) use ($default) { |
||
16 | 3 | return isset($config[$key]) ? $config[$key] : $default; |
|
17 | 3 | }, |
|
18 | 3 | $config |
|
19 | ); |
||
20 | } |
||
21 | |||
39 |