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
03:56 queued 01:10
created

HexRgbColor::validate()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 5

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 16
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 9.6111
cc 5
nc 5
nop 1
crap 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
class HexRgbColor extends Xdigit
17
{
18 22
    public function isValid($input): bool
19
    {
20 22
        if (!is_string($input)) {
21 7
            return false;
22
        }
23
24 15
        if (0 === mb_strpos($input, '#')) {
25 11
            $input = mb_substr($input, 1);
26
        }
27
28 15
        $length = mb_strlen($input);
29 15
        if (3 != $length && 6 != $length) {
30 5
            return false;
31
        }
32
33 10
        return parent::isValid($input);
34
    }
35
}
36