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.

Range::scan()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
nc 2
nop 1
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
ccs 11
cts 11
cp 1
crap 4
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
 * This rule verifying a character out of a given range of characters.
13
 */
14
class Range extends AbstractRule
15
{
16
    /**
17
     * @var string
18
     */
19
    protected $left;
20
21
    /**
22
     * @var string
23
     */
24
    protected $right;
25
26
    /**
27
     * @param string $left First character of characters.
28
     * @param string $right Second character of characters.
29
     * @param string $name
30
     * @param callable $action
31
     */
32 3
    public function __construct($left, $right, $name = "Range", callable $action = null)
33
    {
34 3
        $this->left = (string) $left;
35 3
        $this->right = (string) $right;
36 3
        $this->name = (string) $name;
37 3
        $this->action = $action;
38 3
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 1
    public function scan(Context $context)
44
    {
45 1
        $index = $context->getCursor();
46 1
        $string = $context->value();
47
48 1
        if (is_string($string) && ($string >= $this->left && $string <= $this->right)) {
49 1
            $result = new Result($this->name);
50 1
            $result->setValue($string, $index);
51 1
            $this->action($result);
52
53 1
            return $result;
54
        }
55
56 1
        $context->setCursor($index);
57 1
        $context->error($this, $index);
58 1
        return false;
59
    }
60
}
61