| 1 | <?php |
||
| 8 | final class Cns extends AbstractDocument |
||
| 9 | { |
||
| 10 | const LENGTH = 15; |
||
| 11 | |||
| 12 | const LABEL = 'CNS'; |
||
| 13 | |||
| 14 | const REGEX = '/^([\d]{3})([\d]{4})([\d]{4})([\d]{4})$/'; |
||
| 15 | |||
| 16 | const FORMAT = '$1 $2 $3 $4'; |
||
| 17 | |||
| 18 | const DIGIT_COUNT = 1; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * CNS constructor. |
||
| 22 | * |
||
| 23 | * @param string $number |
||
| 24 | */ |
||
| 25 | 15 | public function __construct($number) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * {@inheritdoc} |
||
| 33 | */ |
||
| 34 | 1 | public function format() |
|
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritdoc} |
||
| 41 | * |
||
| 42 | * Based on given number, it will decide what kind of calculator will use. |
||
| 43 | * |
||
| 44 | * For numbers starting with 7, 8 or 9 will use TemporaryCalculator, |
||
| 45 | * otherwise CnsCalculator. |
||
| 46 | */ |
||
| 47 | 11 | public function calculateDigit($baseNumber) |
|
| 59 | } |
||
| 60 |