Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — 0.9 (#692)
by
unknown
02:58
created

Not   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 48.39%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 11
lcom 1
cbo 1
dl 0
loc 59
ccs 15
cts 31
cp 0.4839
rs 10
c 1
b 1
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A absorbComposite() 0 19 4
A __construct() 0 8 2
A validate() 0 8 2
A assert() 0 16 3
1
<?php
2
namespace Respect\Validation\Rules;
3
4
use Respect\Validation\Validatable;
5
use Respect\Validation\Exceptions\ValidationException;
6
7
class Not extends AbstractRule
8
{
9
    public $rule;
10
11 47
    public function __construct(Validatable $rule)
12
    {
13 47
        if ($rule instanceof AllOff) {
0 ignored issues
show
Bug introduced by
The class Respect\Validation\Rules\AllOff does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
14
            $rule = $this->absorbComposite($rule);
15
        }
16
17 47
        $this->rule = $rule;
18 47
    }
19
20 13
    public function validate($input)
21
    {
22 13
        if ($this->rule instanceof AllOff) {
0 ignored issues
show
Bug introduced by
The class Respect\Validation\Rules\AllOff does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
23
            return $this->rule->validate($input);
24
        }
25
26 13
        return!$this->rule->validate($input);
27
    }
28
29 33
    public function assert($input)
30
    {
31 33
        if ($this->rule instanceof AllOff) {
0 ignored issues
show
Bug introduced by
The class Respect\Validation\Rules\AllOff does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
32
            return $this->rule->assert($input);
33
        }
34
35
        try {
36 33
            $this->rule->assert($input);
37 33
        } catch (ValidationException $e) {
38 23
            return true;
39
        }
40
41 17
        throw $this->rule
42 17
            ->reportError($input)
43 17
            ->setMode(ValidationException::MODE_NEGATIVE);
44
    }
45
46
    protected function absorbComposite(AbstractComposite $compositeRule)
47
    {
48
        if (!$compositeRule instanceof AllOff) {
0 ignored issues
show
Bug introduced by
The class Respect\Validation\Rules\AllOff does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
49
            return $compositeRule;
50
        }
51
52
        $compositeRuleClone = clone $compositeRule;
53
        $compositeRuleClone->removeRules();
54
55
        foreach ($compositeRule->getRules() as $rule) {
56
            if ($rule instanceof AbstractComposite) {
57
                $compositeRuleClone->addRule($this->absorbComposite($rule));
58
            } else {
59
                $compositeRuleClone->addRule(new static($rule));
60
            }
61
        }
62
63
        return $compositeRuleClone;
64
    }
65
}
66