| Conditions | 6 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 6.288 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types = 1); |
||
| 22 | 81 | public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string |
|
| 23 | { |
||
| 24 | 81 | if (! $node instanceof Mandatory && ! $node instanceof Prohibited && ! $node instanceof LogicalNot) { |
|
| 25 | throw new LogicException('Implementation accepts instance of Mandatory, Prohibited or LogicalNot Node'); |
||
| 26 | } |
||
| 27 | 81 | if ($subVisitor === null) { |
|
| 28 | throw new LogicException('Implementation requires sub-visitor'); |
||
| 29 | } |
||
| 30 | 81 | $clause = $subVisitor->visit($node->getOperand(), $subVisitor, $options); |
|
| 31 | 81 | $padding = ''; |
|
| 32 | 81 | if ($node->getToken()->getType() === Tokenizer::TOKEN_LOGICAL_NOT) { |
|
| 33 | 26 | $padding = ' '; |
|
| 34 | } |
||
| 35 | 81 | return "{$node->getToken()->getLexeme()}{$padding}{$clause}"; |
|
| 36 | } |
||
| 39 |