Conditions | 4 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.1755 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
20 | 133 | public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string |
|
21 | { |
||
22 | 133 | if (! $node instanceof Term) { |
|
23 | throw new LogicException('Implementation accepts instance of Term Node'); |
||
24 | } |
||
25 | 133 | $token = $node->getToken(); |
|
26 | 133 | if (! $token instanceof WordToken) { |
|
27 | throw new LogicException('Implementation accepts instance of Word Token'); |
||
28 | } |
||
29 | 133 | $domainPrefix = $token->getDomain() === '' ? '' : "{$token->getDomain()}:"; |
|
30 | 133 | $wordEscaped = preg_replace('/([\\\'"+\-!():#@ ])/', '\\\\$1', $token->getWord()); |
|
31 | 133 | return "{$domainPrefix}{$wordEscaped}"; |
|
32 | } |
||
35 |