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 | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 7 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
6 | 18 | public function validate($input) |
|
7 | { |
||
8 | 18 | if (!is_numeric($input) || $input <= 1) { |
|
9 | 8 | return false; |
|
10 | } |
||
11 | |||
12 | 10 | if ($input != 2 && ($input % 2) == 0) { |
|
13 | 2 | return false; |
|
14 | } |
||
15 | |||
16 | 8 | for ($i = 3; $i <= ceil(sqrt($input)); $i+=2) { |
|
17 | 6 | if (($input % $i) == 0) { |
|
18 | 2 | return false; |
|
19 | } |
||
20 | 6 | } |
|
21 | |||
22 | 6 | return true; |
|
23 | } |
||
24 | } |
||
25 |