Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
15 | 15 | public function convertToXpath(string $expression): string |
|
16 | { |
||
17 | 15 | $xpathExpression = []; |
|
18 | 15 | foreach (explode(', ', $expression) as $part) { |
|
19 | 15 | preg_match('!(.+) (@.+|.+\(\))$!', $part, $matchExpression); |
|
20 | 15 | if (!array_key_exists(2, $matchExpression)) { |
|
21 | 7 | $xpathExpression[] = parent::toXPath($part); |
|
|
|||
22 | } else { |
||
23 | 8 | $xpathExpression[] = parent::toXPath($matchExpression[1]) . '/' . $matchExpression[2]; |
|
24 | } |
||
25 | } |
||
26 | 15 | return implode(' | ', $xpathExpression); |
|
27 | } |
||
28 | |||
31 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.