AbstractRegexValidator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 4 1
getPattern() 0 1 ?
1
<?php
2
3
namespace Jgxvx\Common\Validator;
4
5
abstract class AbstractRegexValidator implements StringValidator
6
{
7
8 14
    public function isValid(string $value) : bool
9
    {
10 14
        return preg_match($this->getPattern(), $value) === 1;
11
    }
12
13
    abstract protected function getPattern() : string;
14
}
15