AbstractValidator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 13
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 4 1
A normalizeValue() 0 4 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