Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
36 | 9 | public function xpath($xpath) |
|
37 | { |
||
38 | 9 | $parts = explode('/', $xpath); |
|
39 | 9 | if (count($parts) != 3) { |
|
40 | 2 | throw new InvalidArgumentException('Path must be in the form of "section/group/element"'); |
|
41 | } |
||
42 | 7 | $process = $this->data; |
|
43 | 7 | foreach ($parts as $part) { |
|
44 | 7 | if (isset($process[$part])) { |
|
45 | 7 | $process = $process[$part]; |
|
46 | } else { |
||
47 | 7 | return null; |
|
48 | } |
||
49 | } |
||
50 | 6 | return $process; |
|
51 | } |
||
52 | |||
55 |