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 (#879)
by
unknown
02:52
created

Phone::getPregFormat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 1
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
                'part2' => '\d{1,3}',
23
                'part3' => '((\d{3,5})[. -]?(\d{4})|(\d{2}[. -]?){4})',
24
            ]
25
        );
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
        }
34
35 73
        return $string;
36
    }
37
}
38