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 — master (#802)
by
unknown
04:45
created

Pis   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 21
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B validate() 0 18 6
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * For the full copyright and license information, please view the "LICENSE.md"
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Respect\Validation\Rules;
11
12
class Pis extends AbstractRule
13
{
14 27
    public function validate($input)
15
    {
16 27
        $c = preg_replace('/\D/', '', $input);
17
18 27
        if (strlen($c) != 11 || preg_match("/^{$c[0]}{11}$/", $c)) {
19 10
            return false;
20
        }
21
22 17
        $r = [3,2,9,8,7,6,5,4,3,2];
23
24 17
        for ($n = 0, $i = 0; $i <= 9; $n += $c[$i] * $r[$i++]);
25
26 17
        if ($c[10] != ((($n %= 11) < 2) ? 0 : 11 - $n)) {
27 4
            return false;
28
        }
29
30 13
        return true;
31
    }
32
}
33