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.

PredicateNot   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A scan() 0 15 2
1
<?php
2
namespace GetSky\ParserExpressions\Rules;
3
4
use GetSky\ParserExpressions\Context;
5
use GetSky\ParserExpressions\RuleInterface;
6
7
/**
8
 * The not-predicate expression !e succeeds if e fails and fails if e succeeds,
9
 * again consuming no input in either case.
10
 *
11
 * @package GetSky\ParserExpressions\Rules
12
 * @author  Alexander Getmanskii <[email protected]>
13
 */
14
class PredicateNot extends AbstractRule
15
{
16
17
    /**
18
     * @var \GetSky\ParserExpressions\RuleInterface
19
     */
20
    protected $rule;
21
22
    /**
23
     * @param array|string|RuleInterface $rule
24
     * @param string $name
25
     */
26 1
    public function __construct($rule, $name = "PredicateNot")
27
    {
28 1
        $this->rule = $this->toRule($rule);
29 1
        $this->name = (string) $name;
30 1
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    public function scan(Context $context)
36
    {
37 1
        $index = $context->getCursor();
38 1
        $context->increaseDepth();
39 1
        $value = $this->rule->scan($context);
40 1
        $context->decreaseDepth();
41 1
        $context->setCursor($index);
42
43 1
        if ($value === false) {
44 1
            return true;
45
        }
46
47 1
        $context->error($this, $index);
48 1
        return false;
49
    }
50
}
51