Strict::process()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 10
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 Strict extends QueryStrategy {
13
14
    /**
15
     * @inheritdoc
16
     */
17 321
    public function process(\Funivan\PhpTokenizer\Collection $collection, $currentIndex) {
18
19 321
      $result = new StrategyResult();
20 321
      $result->setValid(true);
21
22 321
      $token = $collection->offsetGet($currentIndex);
23
24 321
      if ($token === null or $this->isValid($token) === false) {
25 312
        $result->setValid(false);
26 312
        return $result;
27
      }
28
29 303
      $result->setNexTokenIndex(++$currentIndex);
30 303
      $result->setToken($token);
31
32 303
      return $result;
33
    }
34
35
  }