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 — master (#899)
by Henrique
02:18
created

AbstractRule::check()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * (c) Alexandre Gomes Gaigalas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the "LICENSE.md"
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Respect\Validation\Rules;
15
16
use Respect\Validation\Exceptions\ValidationException;
17
use Respect\Validation\Factory;
18
use Respect\Validation\Validatable;
19
use Respect\Validation\Validator;
20
21
abstract class AbstractRule implements Validatable
22
{
23
    protected $name;
24
    protected $template;
25
26 2
    public function __invoke($input)
27
    {
28 2
        return $this->validate($input);
29
    }
30
31 2
    public function assert($input)
32
    {
33 2
        if ($this->validate($input)) {
34 1
            return true;
35
        }
36
37 1
        throw $this->reportError($input);
38
    }
39
40 1
    public function check($input)
41
    {
42 1
        return $this->assert($input);
43
    }
44
45 15
    public function getName()
46
    {
47 15
        return $this->name;
48
    }
49
50
    public function reportError($input, array $extraParams = [])
51
    {
52
        return Factory::getDefaultInstance()->exception($this, $input, $extraParams);
53
    }
54
55 14
    public function setName($name)
56
    {
57 14
        $this->name = $name;
58
59 14
        return $this;
60
    }
61
62 1
    public function setTemplate($template)
63
    {
64 1
        $this->template = $template;
65
66 1
        return $this;
67
    }
68
}
69