| Conditions | 5 |
| Paths | 5 |
| Total Lines | 28 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 5.0073 |
| Changes | 3 | ||
| Bugs | 2 | Features | 2 |
| 1 | <?php |
||
| 36 | 62 | public function process(\Funivan\PhpTokenizer\Collection $collection, $currentIndex) { |
|
| 37 | |||
| 38 | 62 | $result = new StrategyResult(); |
|
| 39 | |||
| 40 | # getProcessor while we can check toke |
||
| 41 | |||
| 42 | 62 | $index = $currentIndex; |
|
| 43 | 62 | $searchForward = ($this->direction === static::FORWARD); |
|
| 44 | |||
| 45 | do { |
||
| 46 | |||
| 47 | 62 | $token = $collection->offsetGet($index); |
|
| 48 | 62 | if ($token === null) { |
|
| 49 | return $result; |
||
| 50 | } |
||
| 51 | 62 | $index = $searchForward ? ++$index : --$index; |
|
| 52 | |||
| 53 | 62 | if ($this->isValid($token)) { |
|
| 54 | 62 | $result->setNexTokenIndex($index); |
|
| 55 | 62 | $result->setValid(true); |
|
| 56 | 62 | $result->setToken($token); |
|
| 57 | 62 | break; |
|
| 58 | } |
||
| 59 | |||
| 60 | 56 | } while (!empty($token)); |
|
| 61 | |||
| 62 | 62 | return $result; |
|
| 63 | } |
||
| 64 | |||
| 80 | } |