|
1 |
| -<?php |
2 |
| - |
3 |
| -/* |
4 |
| - * The MIT License (MIT) |
5 |
| - * |
6 |
| - * Copyright (c) 2014 Niklas Ekman |
7 |
| - * |
8 |
| - * Permission is hereby granted, free of charge, to any person obtaining a copy of |
9 |
| - * this software and associated documentation files (the "Software"), to deal in |
10 |
| - * the Software without restriction, including without limitation the rights to |
11 |
| - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
12 |
| - * the Software, and to permit persons to whom the Software is furnished to do so, |
13 |
| - * subject to the following conditions: |
14 |
| - * |
15 |
| - * The above copyright notice and this permission notice shall be included in all |
16 |
| - * copies or substantial portions of the Software. |
17 |
| - * |
18 |
| - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 |
| - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
20 |
| - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
21 |
| - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
22 |
| - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
23 |
| - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
24 |
| - */ |
25 |
| - |
26 |
| -namespace Nekman\LuhnAlgorithm\Contract; |
27 |
| - |
28 |
| -/** |
29 |
| - * Handles the Luhn Algorithm. |
30 |
| - * |
31 |
| - * @link http://en.wikipedia.org/wiki/Luhn_algorithm |
32 |
| - */ |
33 |
| -interface LuhnAlgorithmInterface { |
34 |
| - /** |
35 |
| - * Determine if a number is valid according to the Luhn Algorithm. |
36 |
| - * |
37 |
| - * @param string $input The number to validate. |
38 |
| - * |
39 |
| - * @return bool true if number is valid, false otherwise. |
40 |
| - * |
41 |
| - * @throws \InvalidArgumentException If the input is invalid. |
42 |
| - */ |
43 |
| - public function isValid(string $input): bool; |
44 |
| - |
45 |
| - /** |
46 |
| - * Calculate the check digit for an input. |
47 |
| - * |
48 |
| - * @param int $input The input to calculate the check digit for. |
49 |
| - * |
50 |
| - * @return int The check digit. |
51 |
| - * |
52 |
| - * @throws \InvalidArgumentException If the input is invalid. |
53 |
| - */ |
54 |
| - public function calcCheckDigit(int $input): int; |
55 |
| - |
56 |
| - /** |
57 |
| - * Calulates the checksum for number. |
58 |
| - * |
59 |
| - * @param int $input The number to calculate the checksum for. |
60 |
| - * |
61 |
| - * @return int The checksum. |
62 |
| - * |
63 |
| - * @throws \InvalidArgumentException If the input is invalid. |
64 |
| - */ |
65 |
| - public function calcChecksum(int $input): int; |
66 |
| -} |
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * The MIT License (MIT) |
| 5 | + * |
| 6 | + * Copyright (c) 2014 Niklas Ekman |
| 7 | + * |
| 8 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 9 | + * this software and associated documentation files (the "Software"), to deal in |
| 10 | + * the Software without restriction, including without limitation the rights to |
| 11 | + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| 12 | + * the Software, and to permit persons to whom the Software is furnished to do so, |
| 13 | + * subject to the following conditions: |
| 14 | + * |
| 15 | + * The above copyright notice and this permission notice shall be included in all |
| 16 | + * copies or substantial portions of the Software. |
| 17 | + * |
| 18 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 20 | + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 21 | + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 22 | + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 23 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 24 | + */ |
| 25 | + |
| 26 | +namespace Nekman\LuhnAlgorithm\Contract; |
| 27 | + |
| 28 | +/** |
| 29 | + * Handles the Luhn Algorithm. |
| 30 | + * |
| 31 | + * @link http://en.wikipedia.org/wiki/Luhn_algorithm |
| 32 | + */ |
| 33 | +interface LuhnAlgorithmInterface |
| 34 | +{ |
| 35 | + /** |
| 36 | + * Determine if a number is valid according to the Luhn Algorithm. |
| 37 | + * |
| 38 | + * @param NumberInterface $number The number to validate. |
| 39 | + * |
| 40 | + * @return bool true if number is valid, false otherwise. |
| 41 | + */ |
| 42 | + public function isValid(NumberInterface $number): bool; |
| 43 | + |
| 44 | + /** |
| 45 | + * Calculate the check digit for an input. |
| 46 | + * |
| 47 | + * @param NumberInterface $number The number to calculate the check digit for. |
| 48 | + * |
| 49 | + * @return int The check digit. |
| 50 | + * |
| 51 | + */ |
| 52 | + public function calcCheckDigit(NumberInterface $number): int; |
| 53 | + |
| 54 | + /** |
| 55 | + * Calulates the checksum for number. |
| 56 | + * |
| 57 | + * @param NumberInterface $number The number to calculate the checksum for. |
| 58 | + * |
| 59 | + * @return int The checksum. |
| 60 | + * |
| 61 | + */ |
| 62 | + public function calcChecksum(NumberInterface $number): int; |
| 63 | +} |
0 commit comments