| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 27 | public function buildRegex(): string |
||
| 28 | { |
||
| 29 | if (!$this->compiledRegex) { |
||
| 30 | $this->registerTokens(); |
||
| 31 | $regex = []; |
||
| 32 | |||
| 33 | foreach ($this->getQueue() as $token) { |
||
| 34 | $regex[] = "(?<{$token->token->value}>{$token->regex})"; |
||
| 35 | } |
||
| 36 | |||
| 37 | $this->compiledRegex = '~(' . implode('|', $regex) . ')~As'; |
||
| 38 | } |
||
| 39 | |||
| 40 | return $this->compiledRegex; |
||
| 41 | } |
||
| 61 |