Conditions | 9 |
Paths | 7 |
Total Lines | 32 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 9.0139 |
Changes | 0 |
1 | <?php |
||
23 | 2 | public function enterNode(Node $node): ?Node |
|
24 | { |
||
25 | 2 | if (!$this->isKnpMenuBuildingMethod($node)) { |
|
26 | 2 | return null; |
|
27 | } |
||
28 | |||
29 | 2 | parent::enterNode($node); |
|
30 | |||
31 | 2 | if (!$node instanceof Node\Expr\MethodCall) { |
|
32 | 2 | return null; |
|
33 | } |
||
34 | |||
35 | 2 | if (!\is_string($node->name) && !$node->name instanceof Node\Identifier) { |
|
36 | return null; |
||
37 | } |
||
38 | |||
39 | 2 | $methodName = (string) $node->name; |
|
40 | 2 | if ('setLinkAttribute' !== $methodName) { |
|
41 | 2 | return null; |
|
42 | } |
||
43 | |||
44 | 2 | $attributeKey = $this->getStringArgument($node, 0); |
|
45 | 2 | $attributeValue = $this->getStringArgument($node, 1); |
|
46 | 2 | if ('title' === $attributeKey && null !== $attributeValue) { |
|
47 | 2 | $line = $node->getAttribute('startLine'); |
|
48 | 2 | if (null !== $location = $this->getLocation($attributeValue, $line, $node)) { |
|
49 | 2 | $this->lateCollect($location); |
|
50 | } |
||
51 | } |
||
52 | |||
53 | 2 | return null; |
|
54 | } |
||
55 | } |
||
56 |