We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 5 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 27 | public function isValid($input): bool |
|
| 34 | { |
||
| 35 | 27 | if (!ctype_digit($input)) { |
|
| 36 | 6 | return false; |
|
| 37 | } |
||
| 38 | |||
| 39 | 22 | if (9 !== mb_strlen($input)) { |
|
| 40 | 3 | return false; |
|
| 41 | } |
||
| 42 | |||
| 43 | 19 | $sum = -1 * $input[8]; |
|
| 44 | 19 | for ($i = 9; $i > 1; --$i) { |
|
| 45 | 19 | $sum += $i * $input[9 - $i]; |
|
| 46 | } |
||
| 47 | |||
| 48 | 19 | return 0 !== $sum && 0 === $sum % 11; |
|
| 49 | } |
||
| 51 |