Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | 10 | public function find(string $index, mixed $default = null): mixed |
|
39 | { |
||
40 | 10 | if (isset($this->data[$index])) { |
|
41 | 5 | return $this->data[$index]; |
|
42 | } |
||
43 | 10 | $data = $this->data; |
|
44 | 10 | foreach (explode('.', $index) as $token) { |
|
45 | 10 | if (false === array_key_exists($token, $data)) { |
|
46 | 4 | return $default; |
|
47 | } |
||
48 | 10 | $data =& $data[$token]; |
|
49 | } |
||
50 | 10 | return $data; |
|
51 | } |
||
62 |