| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | 58 | private function isGoodFloat(int|string|float|null $number): bool |
|
| 43 | { |
||
| 44 | 58 | if (is_float($number)) { |
|
| 45 | 58 | $string_number = str($number); |
|
| 46 | |||
| 47 | 58 | $precision_position = str($string_number->explode('.')->get(1, ''))->length(); |
|
| 48 | |||
| 49 | 58 | $round_number = round($number, $precision_position); |
|
| 50 | |||
| 51 | 58 | if (($round_number == $number && $string_number->length() <= PHP_FLOAT_DIG)) { |
|
| 52 | 45 | return true; |
|
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | 13 | return false; |
|
| 57 | } |
||
| 59 |