Completed
Push — master ( 602e72...ebe83b )
by James Ekow Abaka
01:26
created

NumericValidation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 2
1
<?php
2
3
namespace ntentan\utils\validator\validations;
4
use ntentan\utils\validator\Validation;
5
6
class NumericValidation extends Validation
7
{
8 1
    public function run($field, $data)
9
    {
10 1
        $value = $this->getFieldValue($field, $data);        
11 1
        return $this->evaluateResult(
12 1
            $field,
13 1
            is_numeric($value) || $value === null, 
14 1
            "The {$field['name']} field must contain only numbers"
15
        );     
16
    }
17
}