| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 52 | 7 | private function verifyMod10(string $input): bool |
|
| 53 | { |
||
| 54 | 7 | $sum = 0; |
|
| 55 | 7 | $input = strrev($input); |
|
| 56 | 7 | $inputLen = \strlen($input); |
|
| 57 | 7 | for ($i = 0; $i < $inputLen; $i++) { |
|
| 58 | 7 | $current = $input[$i]; |
|
| 59 | 7 | if ($i % 2 === 1) { |
|
| 60 | 7 | $current *= 2; |
|
| 61 | 7 | if ($current > 9) { |
|
| 62 | 5 | $firstDigit = $current % 10; |
|
| 63 | 5 | $secondDigit = ($current - $firstDigit) / 10; |
|
| 64 | 5 | $current = $firstDigit + $secondDigit; |
|
| 65 | } |
||
| 66 | } |
||
| 67 | 7 | $sum += $current; |
|
| 68 | } |
||
| 69 | |||
| 70 | 7 | return ($sum % 10 === 0); |
|
| 71 | } |
||
| 73 |