Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0987 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | 441 | protected function retrieve($path, $array) |
|
12 | { |
||
13 | 441 | $segments = explode('.', $path); |
|
14 | 441 | $value = $array; |
|
15 | 441 | while ($segment = \array_shift($segments)) { |
|
16 | 441 | if (!\array_key_exists($segment, $value)) { |
|
17 | throw new DotPathException( |
||
18 | sprintf('Path "%s" is not valid : segment "%s" does not exists.', $path, $segment) |
||
19 | ); |
||
20 | } |
||
21 | 441 | $value = $value[$segment]; |
|
22 | } |
||
23 | |||
24 | 441 | return $value; |
|
25 | } |
||
27 |