We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 8 | private function verifyMod10($input) |
|
| 17 | { |
||
| 18 | 8 | $sum = 0; |
|
| 19 | 8 | $input = strrev($input); |
|
| 20 | 8 | for ($i = 0; $i < strlen($input); $i++) { |
|
| 21 | 8 | $current = substr($input, $i, 1); |
|
| 22 | 8 | if ($i % 2 == 1) { |
|
| 23 | 7 | $current *= 2; |
|
| 24 | 7 | if ($current > 9) { |
|
| 25 | 5 | $firstDigit = $current % 10; |
|
| 26 | 5 | $secondDigit = ($current - $firstDigit) / 10; |
|
| 27 | 5 | $current = $firstDigit + $secondDigit; |
|
| 28 | 5 | } |
|
| 29 | 7 | } |
|
| 30 | 8 | $sum += $current; |
|
| 31 | 8 | } |
|
| 32 | |||
| 33 | 8 | return ($sum % 10 == 0); |
|
| 34 | } |
||
| 35 | } |
||
| 36 |