Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
42 | 1 | public function scan(Context $context) |
|
43 | { |
||
44 | 1 | $index = $context->getCursor(); |
|
45 | 1 | $len = strlen($this->rule); |
|
46 | 1 | $char = $context->value(); |
|
47 | 1 | for ($i = 0; $i < $len; ++$i) { |
|
48 | 1 | if ($char === $this->rule{$i}) { |
|
49 | 1 | $result = new Result($this->name); |
|
50 | 1 | $result->setValue($char, $index); |
|
51 | 1 | $this->action($result); |
|
52 | |||
53 | 1 | return $result; |
|
54 | } |
||
55 | }; |
||
56 | |||
57 | 1 | $context->setCursor($index); |
|
58 | 1 | $context->error($this, $index); |
|
59 | 1 | return false; |
|
60 | } |
||
61 | } |
||
62 |