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.0 ( c013fa...145725 )
by Henrique
03:25
created

Phone   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 24
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPregFormat() 0 11 1
A replaceParams() 0 9 2
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 Phone extends AbstractRegexRule
15
{
16 73
    protected function getPregFormat()
17
    {
18 73
        return $this->replaceParams(
19 73
            '/^\+?({part1})? ?(?(?=\()(\({part2}\) ?{part3})|([. -]?({part2}[. -]*)?{part3}))$/',
20
            [
21 73
                'part1' => '\d{0,3}',
22 73
                'part2' => '\d{1,3}',
23 73
                'part3' => '((\d{3,5})[. -]?(\d{4})|(\d{2}[. -]?){4})',
24
            ]
25 73
        );
26
    }
27
28 73
    private function replaceParams($format, array $params)
29
    {
30 73
        $string = $format;
31 73
        foreach ($params as $name => $value) {
32 73
            $string = str_replace('{'.$name.'}', $value, $string);
33 73
        }
34
35 73
        return $string;
36
    }
37
}
38