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 | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | private function verifyMod10($input) |
||
| 26 | { |
||
| 27 | $sum = 0; |
||
| 28 | $input = strrev($input); |
||
| 29 | for ($i = 0, $inputLength = mb_strlen($input); $i < $inputLength; ++$i) { |
||
| 30 | $current = mb_substr($input, $i, 1); |
||
| 31 | if ($i % 2 === 1) { |
||
| 32 | $current *= 2; |
||
| 33 | if ($current > 9) { |
||
| 34 | $firstDigit = $current % 10; |
||
| 35 | $secondDigit = ($current - $firstDigit) / 10; |
||
| 36 | $current = $firstDigit + $secondDigit; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | $sum += $current; |
||
| 40 | } |
||
| 41 | |||
| 42 | return $sum % 10 === 0; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |