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 — 0.9 (#691)
by
unknown
07:33
created

HexRgbColor::validate()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 8.8571
cc 5
eloc 9
nc 5
nop 1
crap 5
1
<?php
2
namespace Respect\Validation\Rules;
3
4
use Respect\Validation\Validator as v;
5
6
class HexRgbColor extends Xdigit
7
{
8 22
    public function validate($input)
9
    {
10 22
        if (!is_string($input)) {
11 7
            return false;
12
        }
13
14 15
        if (0 === strpos($input, '#')) {
15 11
            $input = substr($input, 1);
16 11
        }
17
18 15
        $length = strlen($input);
19 15
        if ($length != 3 && $length != 6) {
20 5
            return false;
21
        }
22
23 10
        return parent::validate($input);
24
    }
25
}
26