| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 14 | 4 | public function validate($data): bool |
|
| 15 | { |
||
| 16 | // Convert the data to a string |
||
| 17 | 4 | $data = strval($data); |
|
| 18 | |||
| 19 | // Check if the data is a valid numeric value |
||
| 20 | 4 | if (!ctype_digit($data)) { |
|
| 21 | 2 | return false; |
|
| 22 | } |
||
| 23 | |||
| 24 | // Convert the data to an integer |
||
| 25 | 2 | $number = intval($data); |
|
| 26 | |||
| 27 | // Check if the number is greater than zero |
||
| 28 | 2 | return $number > 0; |
|
| 29 | } |
||
| 31 |