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