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
Push — 1.1 ( fca464...0e73bc )
by Henrique
09:36 queued 06:14
created

HexRgbColor::validate()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 9.3888
c 0
b 0
f 0
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
namespace Respect\Validation\Rules;
13
14
class HexRgbColor extends Xdigit
15
{
16 22
    public function validate($input)
17
    {
18 22
        if (!is_string($input)) {
19 7
            return false;
20
        }
21
22 15
        if (0 === strpos($input, '#')) {
23 11
            $input = substr($input, 1);
24 11
        }
25
26 15
        $length = strlen($input);
27 15
        if ($length != 3 && $length != 6) {
28 5
            return false;
29
        }
30
31 10
        return parent::validate($input);
32
    }
33
}
34