Possible::process()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 9
nc 2
nop 2
crap 3
1
<?php
2
3
  declare(strict_types=1);
4
5
  namespace Funivan\PhpTokenizer\Strategy;
6
7
8
  /**
9
   *
10
   *
11
   */
12
  class Possible extends QueryStrategy {
13
14
    /**
15
     * @inheritdoc
16
     */
17 216
    public function process(\Funivan\PhpTokenizer\Collection $collection, $currentIndex) {
18
19 216
      $result = new StrategyResult();
20 216
      $result->setValid(true);
21
22 216
      $token = $collection->offsetGet($currentIndex);
23
24 216
      if ($token and $this->isValid($token)) {
25 156
        $result->setToken($token);
26 156
        ++$currentIndex;
27
      }
28
29 216
      $result->setNexTokenIndex($currentIndex);
30
31 216
      return $result;
32
    }
33
34
  }