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 (#923)
by lee
03:57
created

When::check()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
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\AlwaysInvalidException;
17
use Respect\Validation\Validatable;
18
19
class When extends AbstractRule
20
{
21
    public $when;
22
    public $then;
23
    public $else;
24
25 8
    public function __construct(Validatable $when, Validatable $then, Validatable $else = null)
26
    {
27 8
        $this->when = $when;
28 8
        $this->then = $then;
29 8
        if (null === $else) {
30 1
            $else = new AlwaysInvalid();
31 1
            $else->setTemplate(AlwaysInvalidException::SIMPLE);
32
        }
33
34 8
        $this->else = $else;
35 8
    }
36
37 10
    public function validate($input): bool
38
    {
39 10
        if ($this->when->validate($input)) {
40 9
            return $this->then->validate($input);
41
        }
42
43 1
        return $this->else->validate($input);
44
    }
45
46 3
    public function assert($input): void
47
    {
48 3
        if ($this->when->validate($input)) {
49 2
            $this->then->assert($input);
50
51 1
            return;
52
        }
53
54 1
        $this->else->assert($input);
55
    }
56
57 3
    public function check($input): void
58
    {
59 3
        if ($this->when->validate($input)) {
60 2
            $this->then->check($input);
61
62 1
            return;
63
        }
64
65 1
        $this->else->check($input);
66
    }
67
}
68