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

Passed
Push — master ( 04b3c7...10ce81 )
by Henrique
02:28
created

AbstractEnvelope::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
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\Validatable;
17
18
/**
19
 * Abstract class that creates an envelope around another rule.
20
 *
21
 * This class is usefull when you want to create rules that use other rules, but
22
 * having an custom message.
23
 *
24
 * @author Henrique Moody <[email protected]>
25
 */
26
abstract class AbstractEnvelope extends AbstractRule
27
{
28
    /**
29
     * @var Validatable
30
     */
31
    private $validatable;
32
33
    /**
34
     * @var array
35
     */
36
    private $parameters;
37
38
    /**
39
     * Initializes the rule.
40
     *
41
     * @param Validatable $validatable
42
     * @param array $parameters
43
     */
44 11
    public function __construct(Validatable $validatable, array $parameters)
45
    {
46 11
        $this->validatable = $validatable;
47 11
        $this->parameters = $parameters;
48 11
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 10
    public function validate($input): bool
54
    {
55 10
        return $this->validatable->validate($input);
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61 6
    public function reportError($input, array $extraParameters = [])
62
    {
63 6
        return parent::reportError($input, $extraParameters + $this->parameters);
64
    }
65
}
66