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
04:54
created

AbstractNested::addRules()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
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
namespace Respect\Validation\Rules;
13
14
/**
15
 * Abstract class to handle nested rules.
16
 */
17
abstract class AbstractNested implements RuleInterface
18
{
19
    /**
20
     * @var RuleInterface[]
21
     */
22
    private $rules = [];
23
24
    /**
25
     * @param RuleInterface ...$rules
26
     */
27 1
    public function __construct(RuleInterface ...$rules)
28
    {
29 1
        $this->addRules($rules);
30 1
    }
31
32
    /**
33
     * @return RuleInterface[]
34
     */
35 5
    public function getRules()
36
    {
37 5
        return $this->rules;
38
    }
39
40
    /**
41
     * @param RuleInterface $rule
42
     */
43 4
    public function addRule(RuleInterface $rule)
44
    {
45 4
        $this->rules[] = $rule;
46 4
    }
47
48
    /**
49
     * @param RuleInterface[] $rules
50
     */
51 3
    public function addRules(array $rules)
52
    {
53 3
        foreach ($rules as $key => $spec) {
54 3
            $this->addRule($spec);
55 3
        }
56
57 3
        return $this;
58
    }
59
}
60