Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 450 | public function retrieve(string $path, array $array) |
|
24 | { |
||
25 | 450 | $segments = explode('.', $path); |
|
26 | 450 | $value = $array; |
|
27 | 450 | while ($segment = \array_shift($segments)) { |
|
28 | 450 | if (!\array_key_exists($segment, $value)) { |
|
29 | 3 | throw new DotPathException($path, $segment); |
|
30 | } |
||
31 | 450 | $value = $value[$segment]; |
|
32 | } |
||
33 | |||
34 | 447 | return $value; |
|
35 | } |
||
37 |