We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 5 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
36 | 304 | public function isValid($input): bool |
|
37 | { |
||
38 | // Every integer is a factor of zero, and zero is the only integer that |
||
39 | // has zero for a factor. |
||
40 | 304 | if (0 === $this->dividend) { |
|
41 | 36 | return true; |
|
42 | } |
||
43 | |||
44 | // Factors must be integers that are not zero. |
||
45 | 268 | if (!is_numeric($input) || (int) $input != $input || 0 == $input) { |
|
46 | 40 | return false; |
|
47 | } |
||
48 | |||
49 | 228 | $input = (int) abs($input); |
|
50 | 228 | $dividend = (int) abs($this->dividend); |
|
51 | |||
52 | // The dividend divided by the input must be an integer if input is a |
||
53 | // factor of the dividend. |
||
54 | 228 | return is_integer($dividend / $input); |
|
55 | } |
||
57 |