Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
29 | 16 | ||
30 | 16 | while (preg_match($regex, $string, $matches, offset: $offset)) { |
|
31 | $token = $this->getMatchedToken($matches); |
||
32 | 16 | $className = $this->tokenFactory->createFromToken($token); |
|
33 | 16 | ||
34 | $stack[] = new $className($matches[$token->value], $offset); |
||
35 | 16 | $offset += strlen($matches[0]); |
|
36 | } |
||
37 | 288 | ||
38 | return new ArrayIterator($stack); |
||
39 | 288 | } |
|
40 | 288 | ||
41 | 288 | private function getMatchedToken(array $matches): Token |
|
42 | { |
||
43 | 288 | foreach ($matches as $key => $value) { |
|
44 | 286 | if ($value !== '' && !is_int($key)) { |
|
52 |