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::replaceParams()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 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