1 | <?php |
||
5 | final class Renavam extends AbstractDocument |
||
6 | { |
||
7 | const LENGTH = 11; |
||
8 | |||
9 | const LABEL = 'Renavam'; |
||
10 | |||
11 | const REGEX = '/^([\d]{4})([\d]{6})([\d]{1})$/'; |
||
12 | |||
13 | const NUMBER_OF_DIGITS = 1; |
||
14 | |||
15 | /** |
||
16 | * Renavam constructor. |
||
17 | * |
||
18 | * @param string $renavam Only accept numbers |
||
19 | */ |
||
20 | 14 | public function __construct(string $renavam) |
|
26 | |||
27 | 7 | public static function createFromString(string $number) |
|
31 | |||
32 | /** |
||
33 | * Pad left a number to length(11) with 0(ZERO) |
||
34 | * |
||
35 | * @param string $number |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | 14 | private function padNumber(string $number) : string |
|
40 | { |
||
41 | 14 | if (empty($number)) { |
|
42 | return ''; |
||
43 | } |
||
44 | |||
45 | 14 | return str_pad($number, self::LENGTH, 0, STR_PAD_LEFT); |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | 2 | public function format() : string |
|
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | 10 | public function calculateDigit(string $baseNumber) : string |
|
71 | } |
||
72 |
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.