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:27
created

Call::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
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
namespace Respect\Validation\Rules;
13
14
use Respect\Validation\Result;
15
use Respect\Validation\Rule;
16
17
/**
18
 * Executes a callable for the input and then validates its return.
19
 *
20
 * @author Alexandre Gomes Gaigalas <[email protected]>
21
 * @author Henrique Moody <[email protected]>
22
 *
23
 * @since 0.3.9
24
 */
25
final class Call implements Rule
26
{
27
    /**
28
     * @var callable
29
     */
30
    private $callable;
31
32
    /**
33
     * @var Rule
34
     */
35
    private $rule;
36
37
    /**
38
     * Initializes the rule.
39
     *
40
     * @param callable $callable
41
     * @param Rule     $rule
42
     */
43 1
    public function __construct(callable $callable, Rule $rule)
44
    {
45 1
        $this->callable = $callable;
46 1
        $this->rule = $rule;
47 1
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 9
    public function validate($input): Result
53
    {
54 9
        $return = call_user_func($this->callable, $input);
55 9
        $returnResult = $this->rule->validate($return);
56
57 9
        return new Result($returnResult->isValid(), $input, $this, [], $returnResult);
58
    }
59
}
60