We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 25 | public function validate($input) |
|
| 23 | { |
||
| 24 | 25 | if (!is_numeric($input)) { |
|
| 25 | 6 | return false; |
|
| 26 | } |
||
| 27 | |||
| 28 | 19 | $sequence = [0, 1]; |
|
| 29 | 19 | $position = 1; |
|
| 30 | 19 | while ($input > $sequence[$position]) { |
|
| 31 | 15 | ++$position; |
|
| 32 | 15 | $sequence[$position] = $sequence[$position - 1] + $sequence[$position - 2]; |
|
| 33 | 15 | } |
|
| 34 | |||
| 35 | 19 | return $sequence[$position] === (int) $input; |
|
| 36 | } |
||
| 37 | } |
||
| 38 |