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 (#678)
by Henrique
03:31
created

AnyOf::check()   B

Complexity

Conditions 6
Paths 9

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 6.0359

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
ccs 9
cts 10
cp 0.9
rs 8.8571
cc 6
eloc 11
nc 9
nop 1
crap 6.0359

1 Method

Rating   Name   Duplication   Size   Complexity  
A AnyOf::validate() 0 13 3
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
namespace Respect\Validation\Rules;
13
14
use Respect\Validation\Result;
15
use Respect\Validation\Rule;
16
17
/**
18 2
 * Validates if none of the given validators validate.
19
 *
20 2
 * @author Alexandre Gomes Gaigalas <[email protected]>
21 2
 * @author Henrique Moody <[email protected]>
22 2
 *
23 2
 * @since 0.3.9
24 2
 */
25 1
final class AnyOf implements Rule
26
{
27
    /**
28 1
     * @var Rule[]
29
     */
30
    private $rules = [];
31 3
32
    /**
33 3
     * Initializes the rule.
34 3
     *
35 1
     * @param Rule $rule
36
     * @param Rule ...$rule2
37
     */
38
    public function __construct(Rule ...$rule)
39 2
    {
40
        $this->rules = $rule;
41
    }
42 2
43
    /**
44 2
     * {@inheritdoc}
45
     */
46 2
    public function validate($input): Result
47 1
    {
48
        $isValid = false;
49 2
        $childrenResults = [];
50 2
        foreach ($this->rules as $rule) {
51 2
            $childResult = $rule->validate($input);
52
53
            $isValid = $childResult->isValid() || $isValid;
54
            $childrenResults[] = $childResult;
55
        }
56 1
57 1
        return new Result($isValid, $input, $this, [], ...$childrenResults);
58
    }
59
}
60