| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 46 | 1 | public function match($source, TokenFactoryInterface $factory) |
|
| 47 | { |
||
| 48 | 1 | $results = []; |
|
| 49 | 1 | $pos = 0; |
|
| 50 | |||
| 51 | 1 | $len = strlen($this->_substr); |
|
| 52 | |||
| 53 | 1 | while (($pos = strpos($source, $this->_substr, $pos)) !== false) { |
|
| 54 | 1 | $token = $factory->create(['pos' => $pos, 'length' => $len]); |
|
| 55 | 1 | $end = $token->getEnd(); |
|
| 56 | |||
| 57 | 1 | $results[spl_object_hash($token)] = $token; |
|
| 58 | 1 | $results[spl_object_hash($end)] = $end; |
|
| 59 | 1 | $pos += $len; |
|
| 60 | 1 | } |
|
| 61 | |||
| 62 | 1 | return $results; |
|
| 63 | } |
||
| 64 | } |