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

Binary   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A accept() 0 3 2
A visit() 0 10 1
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\LogicalAnd;
7
use Apicart\FQL\Token\Node\LogicalOr;
8
use Apicart\FQL\Value\AbstractNode;
9
10
final class Binary extends AbstractVisitor
11
{
12
13
	public function accept(AbstractNode $node): bool
14
	{
15
		return $node instanceof LogicalAnd || $node instanceof LogicalOr;
16
	}
17
18
19
	public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string
20
	{
21
		/** @var LogicalAnd|LogicalOr $logicalNode */
22
		$logicalNode = $node;
23
		$clauses = [
24
			$subVisitor->visit($logicalNode->getLeftOperand(), $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

24
			$subVisitor->/** @scrutinizer ignore-call */ 
25
                visit($logicalNode->getLeftOperand(), $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...
25
			$subVisitor->visit($logicalNode->getRightOperand(), $subVisitor, $options),
26
		];
27
28
		return implode(" {$logicalNode->getToken()->getLexeme()} ", $clauses);
29
	}
30
31
}
32