Passed
Push — master ( 9787f7...8354ea )
by Tomáš
02:37
created

Group::visit()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 3
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types = 1);
2
3
namespace Apicart\FQL\Tests\Integration\Generator\SQL\Visitor;
4
5
use Apicart\FQL\Generator\Common\AbstractVisitor;
6
use Apicart\FQL\Token\Node\Group as GroupNode;
7
use Apicart\FQL\Value\AbstractNode;
8
9
final class Group extends AbstractVisitor
10
{
11
12
	public function accept(AbstractNode $node): bool
13
	{
14
		return $node instanceof GroupNode;
15
	}
16
17
18
	public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string
19
	{
20
		/** @var GroupNode $groupNode */
21
		$groupNode = $node;
22
23
		$clauses = [];
24
		foreach ($groupNode->getNodes() as $subNode) {
25
			$clauses[] = $subVisitor->visit($subNode, $subVisitor, $options);
0 ignored issues
show
Bug introduced by
The method visit() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
			/** @scrutinizer ignore-call */ 
26
   $clauses[] = $subVisitor->visit($subNode, $subVisitor, $options);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
		}
27
28
		$clauses = implode(' ', $clauses);
29
30
		return "{$groupNode->getTokenLeft()->getDelimiter()}{$clauses}{$groupNode->getTokenRight()->getLexeme()}";
31
	}
32
33
}
34