Conditions | 8 |
Paths | 7 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 8.1867 |
Changes | 0 |
1 | <?php |
||
27 | 1 | public function test($data, $origin = null, array $keys = []): bool |
|
28 | { |
||
29 | 1 | if ($data === null) return false; |
|
30 | 1 | if (is_int($data) || is_float($data)) { |
|
31 | 1 | return $data <= (int) $this->max && $data >= (int) $this->min; |
|
32 | } |
||
33 | 1 | if (is_string($data)) { |
|
34 | 1 | return strcmp($data, $this->min) >= 0 && strcmp($data, $this->max) <= 0; |
|
35 | } |
||
36 | return $data <= $this->max && $data >= $this->min; |
||
37 | } |
||
38 | } |
||
39 |