Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.25 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
20 | 48 | public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string |
|
21 | { |
||
22 | 48 | if (! $node instanceof LogicalAnd && ! $node instanceof LogicalOr) { |
|
23 | throw new LogicException('Implementation accepts instance of LogicalAnd or LogicalOr Node'); |
||
24 | } |
||
25 | 48 | if ($subVisitor === null) { |
|
26 | throw new LogicException('Implementation requires sub-visitor'); |
||
27 | } |
||
28 | $clauses = [ |
||
29 | 48 | $subVisitor->visit($node->getLeftOperand(), $subVisitor, $options), |
|
30 | 48 | $subVisitor->visit($node->getRightOperand(), $subVisitor, $options), |
|
31 | ]; |
||
32 | 48 | return implode(" {$node->getToken()->getLexeme()} ", $clauses); |
|
33 | } |
||
36 |