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

Call::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 2
cts 4
cp 0.5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1.125
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\Rule;
15
use Respect\Validation\Result;
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
    public function __construct(callable $callable, Rule $rule)
44
    {
45
        $this->callable = $callable;
46
        $this->rule = $rule;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 6
    public function validate($input): Result
53
    {
54 6
        $return = call_user_func($callable, $input);
0 ignored issues
show
Bug introduced by
The variable $callable does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
55
        $returnResult = $this->rule->validate($return);
56
57
        return new Result($referenceValueResult->isValid(), $input, $this, [], $returnResult);
0 ignored issues
show
Bug introduced by
The variable $referenceValueResult does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
58
    }
59
}
60