Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
7 | 74 | public function get(string $path) |
|
8 | { |
||
9 | 74 | if ($path == '.') { |
|
10 | 70 | return $this; |
|
11 | } |
||
12 | |||
13 | 54 | $attributes = explode('.', $path); |
|
14 | 54 | unset($attributes[0]); |
|
15 | |||
16 | 54 | $attribute = array_shift($attributes); |
|
17 | 54 | $value = $this->{$attribute}; |
|
18 | |||
19 | 54 | if (!empty($attributes)) { |
|
20 | 24 | $value = $value->get('.' . implode('.', $attributes)); |
|
21 | } |
||
22 | |||
23 | 54 | return $value; |
|
24 | } |
||
25 | } |
||
26 |