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 — 1.1 (#904)
by Jens
04:56
created

Nullable::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 6
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\Validatable;
15
16
class Nullable extends AbstractWrapper
17
{
18
    public function __construct(Validatable $rule)
19
    {
20
        $this->validatable = $rule;
21
    }
22
23
    public function assert($input)
24
    {
25
        if ($input === null) {
26
            return true;
27
        }
28
29
        return parent::assert($input);
30
    }
31
32
    public function check($input)
33
    {
34
        if ($input === null) {
35
            return true;
36
        }
37
38
        return parent::check($input);
39
    }
40
41
    public function validate($input)
42
    {
43
        if ($this->isOptional($input)) {
0 ignored issues
show
Bug introduced by
The method isOptional() does not seem to exist on object<Respect\Validation\Rules\Nullable>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
            return true;
45
        }
46
47
        return parent::validate($input);
48
    }
49
}
50