| 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 | 1 | public function visit(AbstractNode $node, ?AbstractVisitor $subVisitor = null, ?array $options = null): string |
|
| 21 | { |
||
| 22 | 1 | if (! $node instanceof Term) { |
|
| 23 | throw new LogicException('Implementation accepts instance of Term Node'); |
||
| 24 | } |
||
| 25 | 1 | $token = $node->getToken(); |
|
| 26 | 1 | if (! $token instanceof PhraseToken) { |
|
| 27 | throw new LogicException('Implementation accepts instance of Phrase Token'); |
||
| 28 | } |
||
| 29 | 1 | $domainPrefix = $token->getDomain() === '' ? '' : "{$token->getDomain()}:"; |
|
| 30 | 1 | $phraseEscaped = preg_replace("/([\\{$token->getQuote()}])/", '\\\\$1', $token->getPhrase()); |
|
| 31 | 1 | return "{$domainPrefix}{$token->getQuote()}{$phraseEscaped}{$token->getQuote()}"; |
|
| 32 | } |
||
| 35 |