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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 43
rs 10
c 0
b 0
f 0
ccs 16
cts 16
cp 1
wmc 3
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A scan() 0 19 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