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 (#694)
by
unknown
03:32
created

When   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 8
lcom 1
cbo 3
dl 0
loc 45
ccs 21
cts 21
cp 1
rs 10
c 2
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A validate() 0 8 2
A assert() 0 8 2
A check() 0 8 2
1
<?php
2
namespace Respect\Validation\Rules;
3
4
use Respect\Validation\Validatable;
5
use Respect\Validation\Exceptions\AlwaysInvalidException;
6
7
class When extends AbstractRule
8
{
9
    public $when;
10
    public $then;
11
    public $else;
12
13 9
    public function __construct(Validatable $when, Validatable $then, Validatable $else = null)
14
    {
15 9
        $this->when = $when;
16 9
        $this->then = $then;
17 9
        if (null === $else) {
18 3
            $else = new AlwaysInvalid();
19 3
            $else->setTemplate(AlwaysInvalidException::SIMPLE);
20 3
        }
21
22 9
        $this->else = $else;
23 9
    }
24
25 4
    public function validate($input)
26
    {
27 4
        if ($this->when->validate($input)) {
28 3
            return $this->then->validate($input);
29
        }
30
31 2
        return $this->else->validate($input);
32
    }
33
34 3
    public function assert($input)
35
    {
36 3
        if ($this->when->validate($input)) {
37 1
            return $this->then->assert($input);
38
        }
39
40 2
        return $this->else->assert($input);
41
    }
42
43 2
    public function check($input)
44
    {
45 2
        if ($this->when->validate($input)) {
46 1
            return $this->then->check($input);
47
        }
48
49 1
        return $this->else->check($input);
50
    }
51
}
52