1 | <?php |
||
20 | class EcuadorIdentification |
||
21 | { |
||
22 | /** |
||
23 | * Error encapsulator variable |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $error; |
||
28 | |||
29 | /** |
||
30 | * Validation types |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | private const TYPES = [ |
||
35 | 'final_customer' => 'validateFinalConsumer', |
||
36 | 'personal_identification' => 'validatePersonalIdentification', |
||
37 | 'natural_ruc' => 'validateNaturalRuc', |
||
38 | 'public_ruc' => 'validatePublicRuc', |
||
39 | 'private_ruc' => 'validatePrivateRuc', |
||
40 | 'ruc' => 'validateRuc', |
||
41 | 'is_natural_person' => 'validateIsNaturalPersons', |
||
42 | 'is_juridical_person' => 'validateIsJuridicalPersons', |
||
43 | 'all_identifications' => 'validateAllTypeIdentification', |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * Set Error |
||
48 | * |
||
49 | * @param string|null $error |
||
50 | */ |
||
51 | protected function setError(?string $error): void |
||
55 | |||
56 | /** |
||
57 | * Get Error |
||
58 | * |
||
59 | * @return string|null |
||
60 | */ |
||
61 | public function getError() |
||
65 | |||
66 | /** |
||
67 | * Validate that the Ecuadorian identification is valid |
||
68 | * |
||
69 | * @param $attribute |
||
70 | * @param $value |
||
71 | * @param $parameters |
||
72 | * @param $validator |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function validate($attribute, $value, $parameters, $validator) |
||
85 | |||
86 | /** |
||
87 | * Validates the Ecuadorian Final Consumer |
||
88 | * |
||
89 | * @param string $identification_number Final Consumer Identification |
||
90 | * @return string|null |
||
91 | */ |
||
92 | public function validateFinalConsumer(string $identification_number) |
||
103 | |||
104 | /** |
||
105 | * Validates the Ecuadorian Identification Card |
||
106 | * |
||
107 | * @param string $identification_number Number of Identification Card |
||
108 | * @return string|null |
||
109 | */ |
||
110 | public function validatePersonalIdentification(string $identification_number) |
||
121 | |||
122 | /** |
||
123 | * Validates the Ecuadorian RUC of Natural Person |
||
124 | * |
||
125 | * @param string $identification_number Number of RUC Natural Person |
||
126 | * @return string|null |
||
127 | */ |
||
128 | public function validateNaturalRuc(string $identification_number) |
||
139 | |||
140 | /** |
||
141 | * Validates the Ecuadorian RUC of Public Companies |
||
142 | * |
||
143 | * @param string $identification_number Number of RUC Public Companies |
||
144 | * @return string|null |
||
145 | */ |
||
146 | public function validatePublicRuc(string $identification_number) |
||
157 | |||
158 | /** |
||
159 | * Validates the Ecuadorian RUC of Private Companies |
||
160 | * |
||
161 | * @param string $identification_number Number of RUC Private Companies |
||
162 | * @return string|null |
||
163 | */ |
||
164 | public function validatePrivateRuc(string $identification_number) |
||
175 | |||
176 | /** |
||
177 | * Validates the Ecuadorian Ruc's |
||
178 | * |
||
179 | * @param string $identification_number Number of RUC |
||
180 | * @return string|null |
||
181 | */ |
||
182 | public function validateRuc(string $identification_number) |
||
194 | |||
195 | /** |
||
196 | * Validate that the number belongs to natural persons. |
||
197 | * |
||
198 | * @param string $identification_number Number of identification |
||
199 | * @return string|null |
||
200 | */ |
||
201 | public function validateIsNaturalPersons(string $identification_number) |
||
205 | |||
206 | /** |
||
207 | * Validate that the number belongs to juridical persons. |
||
208 | * |
||
209 | * @param string $identification_number Number of identification |
||
210 | * @return string|null |
||
211 | */ |
||
212 | public function validateIsJuridicalPersons(string $identification_number) |
||
216 | |||
217 | /** |
||
218 | * Validate the number with all types of documents. |
||
219 | * |
||
220 | * @param string $identification_number Number of identification |
||
221 | * @return string|null |
||
222 | */ |
||
223 | public function validateAllTypeIdentification(string $identification_number) |
||
235 | } |
||
236 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.