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.

PredicateAnd::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
crap 1
1
<?php
2
namespace GetSky\ParserExpressions\Rules;
3
4
use GetSky\ParserExpressions\Context;
5
use GetSky\ParserExpressions\RuleInterface;
6
7
/**
8
 * The and-predicate expression &e invokes the sub-expression e,
9
 * and then succeeds if e succeeds and fails if e fails, but in
10
 * either case never consumes any input.
11
 *
12
 * @package GetSky\ParserExpressions\Rules
13
 * @author  Alexander Getmanskii <[email protected]>
14
 */
15
class PredicateAnd extends AbstractRule
16
{
17
18
    /**
19
     * @var \GetSky\ParserExpressions\RuleInterface
20
     */
21
    protected $rule;
22
23
    /**
24
     * @param array|string|RuleInterface $rule
25
     * @param string $name
26
     */
27 1
    public function __construct($rule, $name = "PredicateAnd")
28
    {
29 1
        $this->rule = $this->toRule($rule);
30 1
        $this->name = (string) $name;
31 1
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function scan(Context $context)
37
    {
38 1
        $index = $context->getCursor();
39 1
        $context->increaseDepth();
40 1
        $value = $this->rule->scan($context);
41 1
        $context->decreaseDepth();
42 1
        $context->setCursor($index);
43
44 1
        if ($value === false) {
45 1
            $context->error($this, $index);
46 1
            return false;
47
        }
48
49 1
        return true;
50
    }
51
}
52