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

AbstractRule::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
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\Factory;
17
use Respect\Validation\Validatable;
18
19
abstract class AbstractRule implements Validatable
20
{
21
    protected $name;
22
    protected $template;
23
24 2
    public function __invoke($input)
25
    {
26 2
        return $this->validate($input);
27
    }
28
29 2
    public function assert($input): void
30
    {
31 2
        if ($this->validate($input)) {
32 1
            return;
33
        }
34
35 1
        throw $this->reportError($input);
36
    }
37
38 1
    public function check($input): void
39
    {
40 1
        $this->assert($input);
41 1
    }
42
43 15
    public function getId()
44
    {
45 15
        return $this->name;
46
    }
47
48
    public function reportError($input, array $extraParams = [])
49
    {
50
        return Factory::getDefaultInstance()->exception($this, $input, $extraParams);
51
    }
52
53 11
    public function setId($name)
54
    {
55 11
        $this->name = $name;
56
57 11
        return $this;
58
    }
59
60 1
    public function setTemplate($template)
61
    {
62 1
        $this->template = $template;
63
64 1
        return $this;
65
    }
66
}
67