| Conditions | 7 |
| Paths | 10 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 28 | protected function validation($input, &$value): bool |
|
| 43 | { |
||
| 44 | 28 | if (\is_bool($input)) { |
|
| 45 | 2 | return false; |
|
| 46 | } |
||
| 47 | |||
| 48 | 26 | if ($this->strict) { |
|
| 49 | 2 | $return = \is_float($input) ? $input : false; |
|
|
|
|||
| 50 | } else { |
||
| 51 | 24 | $return = filter_var($input, FILTER_VALIDATE_FLOAT); |
|
| 52 | } |
||
| 53 | |||
| 54 | 26 | if ($return === false) { |
|
| 55 | 6 | return false; |
|
| 56 | } |
||
| 57 | |||
| 58 | 20 | if ($return < $this->min || $return > $this->max) { |
|
| 59 | 4 | return false; |
|
| 60 | } |
||
| 61 | |||
| 62 | 17 | $value = $return; |
|
| 63 | |||
| 64 | 17 | return true; |
|
| 65 | } |
||
| 67 |