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
02:58
created

Call   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 35
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A apply() 0 7 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 apply($input): Result
53
    {
54 9
        $return = call_user_func($this->callable, $input);
55 9
        $returnResult = $this->rule->apply($return);
56
57 9
        return new Result($returnResult->isValid(), $input, $this, [], $returnResult);
58
    }
59
}
60