We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 7 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 20 | public function isValid($input): bool |
|
| 35 | { |
||
| 36 | 20 | if (!is_numeric($input) || $input <= 1) { |
|
| 37 | 10 | return false; |
|
| 38 | } |
||
| 39 | |||
| 40 | 11 | if (2 != $input && 0 == ($input % 2)) { |
|
| 41 | 3 | return false; |
|
| 42 | } |
||
| 43 | |||
| 44 | 9 | for ($i = 3; $i <= ceil(sqrt((float) $input)); $i += 2) { |
|
| 45 | 7 | if (0 == ($input % $i)) { |
|
| 46 | 2 | return false; |
|
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | 7 | return true; |
|
| 51 | } |
||
| 53 |