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.

Runner::hasError()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
ccs 0
cts 8
cp 0
crap 6
1
<?php
2
/**
3
 * @author  Alexander Getmanskii <[email protected]>
4
 * @package GetSky\ParserExpressions
5
 */
6
namespace GetSky\ParserExpressions;
7
8
class Runner
9
{
10
    /**
11
     * @var Context
12
     */
13
    protected $context;
14
15
    /**
16
     * @var RuleInterface
17
     */
18
    protected $rule;
19
20
    /**
21
     * @var ErrorCollectionInterface
22
     */
23
    protected $errors;
24
25
    /**
26
     * @param RuleInterface $rule
27
     * @param Context $context
28
     * @param ErrorCollectionInterface $errors
29
     */
30
    public function __construct(RuleInterface $rule, Context $context = null, ErrorCollectionInterface $errors = null)
31
    {
32
        $this->rule = $rule;
33
        $this->errors = !$errors ? new ErrorCollection() : $errors;
34
        $this->context = !$context ? new Context($this->errors) : $context;
35
    }
36
37
    /**
38
     * @param string $string
39
     * @return bool|Result
40
     * @throws \Exception
41
     */
42
    public function run($string)
43
    {
44
        $this->context->setString($string);
45
46
        return $this->rule->scan($this->context);
47
    }
48
49
    /**
50
     * @return bool|ParsingErrorInterface
51
     */
52
    public function hasError()
53
    {
54
        $error = $this->errors->findMaxErrors();
55
        if ($error) {
56
            return $error;
57
        }
58
59
        return false;
60
    }
61
}
62