1 | <?php |
||
5 | final class Voter extends AbstractDocument |
||
6 | { |
||
7 | const LENGTH = 12; |
||
8 | |||
9 | const LABEL = 'Voter'; |
||
10 | |||
11 | const NUMBER_OF_DIGITS = 2; |
||
12 | |||
13 | private $section; |
||
14 | |||
15 | private $zone; |
||
16 | |||
17 | /** |
||
18 | * Voter constructor. |
||
19 | * |
||
20 | * @param string $number |
||
21 | * @param string $section [optional] |
||
22 | * @param string $zone [optional] |
||
23 | */ |
||
24 | 26 | public function __construct($number, $section = null, $zone = null) |
|
32 | |||
33 | 13 | public static function createFromString($number, $section = null, $zone = null) |
|
37 | |||
38 | /** |
||
39 | * Gets section. |
||
40 | * |
||
41 | * @return string Returns section. |
||
42 | */ |
||
43 | public function getSection() |
||
47 | |||
48 | /** |
||
49 | * Gets zone. |
||
50 | * |
||
51 | * @return string Returns zone. |
||
52 | */ |
||
53 | public function getZone() |
||
57 | |||
58 | /** |
||
59 | * Voter does not has a specific format. |
||
60 | * |
||
61 | * @return string Returns only numbers. |
||
62 | */ |
||
63 | 2 | public function format() |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 18 | public function calculateDigit($baseNumber) |
|
78 | |||
79 | /** |
||
80 | * Calculate check digit from base number. |
||
81 | * |
||
82 | * @param string $baseNumber Base numeric section to be calculate your digit. |
||
83 | * |
||
84 | * @return string Returns the checker digit. |
||
85 | */ |
||
86 | 18 | private function calculateFirstDigit($baseNumber) |
|
95 | |||
96 | /** |
||
97 | * Calculate check digit from base number. |
||
98 | * |
||
99 | * @param string $baseNumber Base numeric section to be calculate your digit. |
||
100 | * |
||
101 | * @return string Returns the checker digit. |
||
102 | */ |
||
103 | 18 | private function calculateSecondDigit($baseNumber) |
|
112 | } |
||
113 |
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.