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