Conditions | 6 |
Paths | 8 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | private function &dotGet(array &$data, string $name) |
||
24 | { |
||
25 | //Generating path relative to a given name and prefix |
||
26 | $path = (!empty($this->prefix) ? $this->prefix . '.' : '') . $name; |
||
27 | if (empty($path)) { |
||
28 | return $data; |
||
29 | } |
||
30 | |||
31 | $path = explode('.', rtrim($path, '.')); |
||
32 | foreach ($path as $step) { |
||
33 | if (!is_array($data) || !array_key_exists($step, $data)) { |
||
34 | throw new DotNotFoundException("Unable to find config element '{$name}'."); |
||
35 | } |
||
36 | $data = &$data[$step]; |
||
37 | } |
||
38 | |||
39 | return $data; |
||
40 | } |
||
42 |