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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 10
dl 0
loc 21
c 0
b 0
f 0
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 19 5
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