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
Pull Request — master (#1087)
by Henrique
02:56
created

NotBlank::isValid()   A

Complexity

Conditions 5
Paths 9

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5

Importance

Changes 0
Metric Value
cc 5
eloc 9
nc 9
nop 1
dl 0
loc 19
ccs 10
cts 10
cp 1
crap 5
rs 9.6111
c 0
b 0
f 0
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 stdClass;
17
18
class NotBlank extends AbstractRule
19
{
20 27
    public function isValid($input): bool
21
    {
22 27
        if (is_numeric($input)) {
23 14
            return 0 != $input;
24
        }
25
26 20
        if (is_string($input)) {
27 9
            $input = trim($input);
28
        }
29
30 20
        if ($input instanceof stdClass) {
31 3
            $input = (array) $input;
32
        }
33
34 20
        if (is_array($input)) {
35 13
            $input = array_filter($input, __METHOD__);
36
        }
37
38 20
        return !empty($input);
39
    }
40
}
41