Completed
Push — master ( faad6e...37d694 )
by Jürg
07:54
created

AbstractValidator::normalizeValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Jgxvx\Common\Validator\CreditCardNumber;
4
5
use Jgxvx\Common\Validator\AbstractRegexValidator;
6
7
abstract class AbstractValidator extends AbstractRegexValidator
8
{
9
10 6
    public function isValid(string $value) : bool
11
    {
12 6
        return parent::isValid($this->normalizeValue($value));
13
    }
14
15 6
    private function normalizeValue(string $value) : string
16
    {
17 6
        return str_replace([' ', '.', '-', ','], '', $value);
18
    }
19
}
20