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 NUMBER_OF_DIGITS = 1; |
||
19 | |||
20 | /** |
||
21 | * CNS constructor. |
||
22 | * |
||
23 | * @param string $number |
||
24 | */ |
||
25 | 30 | public function __construct($number) |
|
30 | |||
31 | 15 | public static function createFromString($number) |
|
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 2 | public function format() |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | * |
||
47 | * Based on given number, it will decide what kind of calculator will use. |
||
48 | * |
||
49 | * For numbers starting with 7, 8 or 9 will use TemporaryCalculator, |
||
50 | * otherwise CnsCalculator. |
||
51 | */ |
||
52 | 22 | public function calculateDigit($baseNumber) |
|
64 | } |
||
65 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.