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 (#651)
by Reginaldo
04:33
created

CreditCardVisa::verifyIfCardIsVisa()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
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 CreditCardVisa extends CreditCard
15
{
16
17 14
    public function validate($input)
18
    {
19 14
        $input = preg_replace('([^0-9])', '', $input);
20
        
21 14
        if (empty($input)) {
22 3
            return false;
23
        }
24
25 11
        if (!$this->verifyMod10($input)) {
26 3
            return false;
27
        }
28
29 8
        return $this->verifyIfCardIsVisa($input);
30
    }
31
32 8
    private function verifyIfCardIsVisa($input)
33
    {
34 8
        $pattern = "/^([4]{1})([0-9]{12,15})$/";//Visa
35
36 8
        if (preg_match($pattern, $input)) {
37 5
            return true;
38
        }
39
40 3
        return false;
41
    }
42
43
}
44