GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Row::scan()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
ccs 11
cts 11
cp 1
crap 2
1
<?php
2
/**
3
 * @author  Alexander Getmanskii <[email protected]>
4
 * @package GetSky\ParserExpressions\Rules
5
 */
6
namespace GetSky\ParserExpressions\Rules;
7
8
use GetSky\ParserExpressions\Context;
9
use GetSky\ParserExpressions\Result;
10
11
/**
12
 * It's rule that only succeeds if strings are equal.
13
 */
14
class Row extends AbstractRule
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected $rule;
21
22
    /**
23
     * @param string|int $rule String rule
24
     * @param callable $action
25
     * @param string|int $name
26
     */
27 4
    public function __construct($rule, $name = "Row", callable $action = null)
28
    {
29 4
        $this->rule = (string) $rule;
30 4
        $this->name = (string) $name;
31 4
        $this->action = $action;
32 4
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 1
    public function scan(Context $context)
38
    {
39 1
        $index = $context->getCursor();
40
41 1
        $string = $context->value(strlen($this->rule));
42
43 1
        if ($string !== $this->rule) {
44 1
            $context->setCursor($index);
45 1
            $context->error($this, $index);
46
47 1
            return false;
48
        }
49
50 1
        $result = new Result($this->name);
51 1
        $result->setValue($string, $index);
52 1
        $this->action($result);
53
54 1
        return $result;
55
    }
56
}
57