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

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 10
c 0
b 0
f 0
ccs 17
cts 17
cp 1
wmc 5
lcom 1
cbo 3

2 Methods

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