Passed
Push — master ( 44542b...077e9d )
by Tomáš
03:58
created

BinaryOperator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 19
ccs 7
cts 7
cp 1
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\Generator\SQL;
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 BinaryOperator extends AbstractVisitor
11
{
12
13 1
    public function accept(AbstractNode $node): bool
14
    {
15 1
        return $node instanceof LogicalAnd || $node instanceof LogicalOr;
16
    }
17
18
19 1
    public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string
20
    {
21
        /** @var LogicalAnd|LogicalOr $logicalNode */
22 1
        $logicalNode = $node;
23
        $clauses = [
24 1
            $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 1
            $subVisitor->visit($logicalNode->getRightOperand(), $subVisitor, $options),
26
        ];
27
28 1
        return implode(" {$logicalNode->getToken()->getLexeme()} ", $clauses);
29
    }
30
31
}
32