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:26
created

VisaCreditCard::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 2
eloc 3
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 VisaCreditCard extends CreditCard
15
{
16
17 14
    public function validate($input)
18
    {
19 14
        $input = preg_replace('([^0-9])', '', $input);
20
        
21 14
        return parent::verifyMod10($input) && $this->verifyIfCardIsVisa($input);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (verifyMod10() instead of validate()). Are you sure this is correct? If so, you might want to change this to $this->verifyMod10().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
22
    }
23
24 11
    private function verifyIfCardIsVisa($input)
25
    {
26 11
        $pattern = "/^4[0-9]{12,15}$/";//Visa
27
28 11
        return (preg_match($pattern, $input) > 0);
29
    }
30
31
}
32