Conditions | 5 |
Paths | 12 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types = 1); |
||
18 | 1 | public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string |
|
19 | { |
||
20 | /** @var GroupNode $groupNode */ |
||
21 | 1 | $groupNode = $node; |
|
22 | |||
23 | 1 | $clauses = []; |
|
24 | 1 | foreach ($groupNode->getNodes() as $subNode) { |
|
25 | 1 | $options['parent'] = $node; |
|
26 | 1 | if ($subVisitor !== null) { |
|
27 | 1 | $clauses[] = $subVisitor->visit($subNode, $subVisitor, $options); |
|
28 | } |
||
29 | } |
||
30 | |||
31 | 1 | $clauses = implode(' ', $clauses); |
|
32 | 1 | $tokenLeft = $groupNode->getTokenLeft(); |
|
33 | 1 | $tokenRight = $groupNode->getTokenRight(); |
|
34 | |||
35 | 1 | $delimiter = $tokenLeft === null ? '' : $tokenLeft->getDelimiter(); |
|
36 | 1 | $lexeme = $tokenRight === null ? '' : $tokenRight->getLexeme(); |
|
37 | |||
38 | 1 | return "{$delimiter}{$clauses}{$lexeme}"; |
|
39 | } |
||
42 |