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