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