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