1 | <?php |
||
7 | final class Voter extends AbstractDocument |
||
8 | { |
||
9 | const LENGTH = 12; |
||
10 | |||
11 | const LABEL = 'Voter'; |
||
12 | |||
13 | const NUMBER_OF_DIGITS = 2; |
||
14 | |||
15 | private $section; |
||
16 | |||
17 | private $zone; |
||
18 | |||
19 | /** |
||
20 | * Voter constructor. |
||
21 | * |
||
22 | * @param string $number |
||
23 | * @param string $section [optional] |
||
24 | * @param string $zone [optional] |
||
25 | */ |
||
26 | 26 | public function __construct($number, $section = null, $zone = null) |
|
34 | |||
35 | 13 | public static function createFromString($number, $section = null, $zone = null) |
|
39 | |||
40 | /** |
||
41 | * Gets section. |
||
42 | * |
||
43 | * @return string Returns section. |
||
44 | */ |
||
45 | public function getSection() |
||
49 | |||
50 | /** |
||
51 | * Gets zone. |
||
52 | * |
||
53 | * @return string Returns zone. |
||
54 | */ |
||
55 | public function getZone() |
||
59 | |||
60 | /** |
||
61 | * Voter does not has a specific format. |
||
62 | * |
||
63 | * @return string Returns only numbers. |
||
64 | */ |
||
65 | 2 | public function format() |
|
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | 18 | public function calculateDigit($baseNumber) |
|
80 | |||
81 | /** |
||
82 | * Calculate check digit from base number. |
||
83 | * |
||
84 | * @param string $baseNumber Base numeric section to be calculate your digit. |
||
85 | * |
||
86 | * @return string Returns the checker digit. |
||
87 | */ |
||
88 | 18 | private function calculateFirstDigit($baseNumber) |
|
97 | |||
98 | /** |
||
99 | * Calculate check digit from base number. |
||
100 | * |
||
101 | * @param string $baseNumber Base numeric section to be calculate your digit. |
||
102 | * |
||
103 | * @return string Returns the checker digit. |
||
104 | */ |
||
105 | 18 | private function calculateSecondDigit($baseNumber) |
|
114 | } |
||
115 |
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.