Passed
Push — master ( 36a33a...a2faa0 )
by Aleksandr
01:53
created

NumericConstraint   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 6 2
1
<?php
2
3
namespace Drobotik\Eav\Validation\Constraints;
4
5
use Drobotik\Eav\Interfaces\ConstraintInterface;
6
7
class NumericConstraint implements ConstraintInterface
8
{
9 1
    public function validate($value): ?string
10
    {
11 1
        if (!is_numeric($value)) {
12 1
            return "This value must be a number.";
13
        }
14 1
        return null;
15
    }
16
}