Completed
Push — master ( 39ca89...64a0db )
by James Ekow Abaka
03:49
created

NumericValidation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

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

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
            $field,
13 1
            is_numeric($value) || $value === null, 
14 1
            "The {$field['name']} field must contain only numbers"
15
        );     
16
    }
17
}