1 | <?php |
||
13 | abstract class AbstractId implements IdInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var string Serial number pre delimiter |
||
17 | */ |
||
18 | protected $serialPre = '000000'; |
||
19 | |||
20 | /** |
||
21 | * @var string Serial number post delimiter |
||
22 | */ |
||
23 | protected $serialPost = '000'; |
||
24 | |||
25 | /** |
||
26 | * @var string Date and control string delimiter (- or +) |
||
27 | */ |
||
28 | protected $delimiter = '-'; |
||
29 | |||
30 | /** |
||
31 | * @var string Check digit |
||
32 | */ |
||
33 | protected $checkDigit = '0'; |
||
34 | |||
35 | 100 | public function getId() |
|
42 | |||
43 | 15 | public function __tostring() |
|
47 | |||
48 | 1 | public function format($format) |
|
52 | |||
53 | 101 | public function getSerialPreDelimiter() |
|
57 | |||
58 | 102 | public function getSerialPostDelimiter() |
|
62 | |||
63 | 108 | public function getDelimiter() |
|
67 | |||
68 | 101 | public function getCheckDigit() |
|
72 | |||
73 | 2 | public function getBirthDate() |
|
77 | |||
78 | public function getDate() |
||
83 | |||
84 | 3 | public function getAge(\DateTimeInterface $atDate = null) |
|
88 | |||
89 | 4 | public function getCentury() |
|
93 | |||
94 | 2 | public function getSex() |
|
98 | |||
99 | 4 | public function isMale() |
|
103 | |||
104 | 4 | public function isFemale() |
|
108 | |||
109 | 4 | public function isSexUndefined() |
|
113 | |||
114 | 2 | public function getBirthCounty() |
|
118 | |||
119 | 2 | public function getLegalForm() |
|
123 | |||
124 | 3 | public function isLegalFormUndefined() |
|
128 | |||
129 | 3 | public function isStateOrParish() |
|
133 | |||
134 | 3 | public function isIncorporated() |
|
138 | |||
139 | 3 | public function isPartnership() |
|
143 | |||
144 | 3 | public function isAssociation() |
|
148 | |||
149 | 3 | public function isNonProfit() |
|
153 | |||
154 | 3 | public function isTradingCompany() |
|
158 | |||
159 | /** |
||
160 | * Parse id using regular expression |
||
161 | * |
||
162 | * @param string $regexp |
||
163 | * @param string $raw |
||
164 | * @return string[] Array of matches |
||
165 | * @throws InvalidStructureException If regular expression does not match |
||
166 | */ |
||
167 | 179 | protected function parseNumber($regexp, $raw) |
|
175 | |||
176 | /** |
||
177 | * Verify that the last digit of id is a valid check digit |
||
178 | * |
||
179 | * @return void |
||
180 | * @throws InvalidCheckDigitException If check digit is not valid |
||
181 | */ |
||
182 | 95 | protected function validateCheckDigit() |
|
188 | } |
||
189 |