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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 5
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 20
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B validate() 0 17 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