| 1 | <?php |
||
| 10 | class Modulo10 implements Calculator |
||
| 11 | { |
||
| 12 | use AssertionsTrait; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Check if the last digit of number is a valid modulo 10 check digit |
||
| 16 | */ |
||
| 17 | 9 | public function isValid(string $number): bool |
|
| 21 | |||
| 22 | /** |
||
| 23 | * Calculate the modulo 10 check digit for number |
||
| 24 | * |
||
| 25 | * @throws InvalidStructureException If $number is not numerical |
||
| 26 | */ |
||
| 27 | 18 | public function calculateCheckDigit(string $number): string |
|
| 41 | |||
| 42 | 4 | protected function calculateSum(string $number): int |
|
| 55 | } |
||
| 56 |