Total Complexity | 42 |
Total Lines | 493 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Complex classes like PersonalContainer often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use PersonalContainer, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
12 | class PersonalContainer extends AbstractContainer |
||
13 | { |
||
14 | /** |
||
15 | * Merchant's customer ID (Permitted symbols: 0-9, a-z, A-Z, .,-,_,/) |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $customerid; |
||
20 | |||
21 | /** |
||
22 | * PAYONE debtor ID |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $userid; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $salutation; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $title; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $firstname; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $lastname; |
||
47 | |||
48 | /** |
||
49 | * @var string|null |
||
50 | */ |
||
51 | protected $company; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $street; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | protected $addressaddition; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | protected $zip; |
||
67 | |||
68 | /** |
||
69 | * @var string |
||
70 | */ |
||
71 | protected $city; |
||
72 | |||
73 | /** |
||
74 | * Country (ISO-3166) |
||
75 | * |
||
76 | * @var string |
||
77 | */ |
||
78 | protected $country; |
||
79 | |||
80 | /** |
||
81 | * @var string |
||
82 | */ |
||
83 | protected $state; |
||
84 | |||
85 | /** |
||
86 | * @var string |
||
87 | */ |
||
88 | protected $email; |
||
89 | |||
90 | /** |
||
91 | * @var string |
||
92 | */ |
||
93 | protected $telephonenumber; |
||
94 | |||
95 | /** |
||
96 | * Date of birth (YYYYMMDD) |
||
97 | * |
||
98 | * @var string |
||
99 | */ |
||
100 | protected $birthday; |
||
101 | |||
102 | /** |
||
103 | * Language indicator (ISO639) |
||
104 | * |
||
105 | * @var string |
||
106 | */ |
||
107 | protected $language; |
||
108 | |||
109 | /** |
||
110 | * @var string |
||
111 | */ |
||
112 | protected $vatid; |
||
113 | |||
114 | /** |
||
115 | * @var string |
||
116 | */ |
||
117 | protected $gender; |
||
118 | |||
119 | /** |
||
120 | * @var string |
||
121 | */ |
||
122 | protected $personalId; |
||
123 | |||
124 | /** |
||
125 | * @var string |
||
126 | */ |
||
127 | protected $ip; |
||
128 | |||
129 | /** |
||
130 | * @param string $addressaddition |
||
131 | * |
||
132 | * @return void |
||
133 | */ |
||
134 | public function setAddressAddition($addressaddition) |
||
135 | { |
||
136 | $this->addressaddition = $addressaddition; |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * @return string|null |
||
141 | */ |
||
142 | public function getAddressAddition() |
||
143 | { |
||
144 | return $this->addressaddition; |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * @param string $birthday |
||
149 | * |
||
150 | * @return void |
||
151 | */ |
||
152 | public function setBirthday($birthday) |
||
153 | { |
||
154 | $this->birthday = $birthday; |
||
155 | } |
||
156 | |||
157 | /** |
||
158 | * @return string |
||
159 | */ |
||
160 | public function getBirthday() |
||
161 | { |
||
162 | return $this->birthday; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * @param string $city |
||
167 | * |
||
168 | * @return void |
||
169 | */ |
||
170 | public function setCity($city) |
||
171 | { |
||
172 | $this->city = $city; |
||
173 | } |
||
174 | |||
175 | /** |
||
176 | * @return string|null |
||
177 | */ |
||
178 | public function getCity() |
||
179 | { |
||
180 | return $this->city; |
||
181 | } |
||
182 | |||
183 | /** |
||
184 | * @param string|null $company |
||
185 | * |
||
186 | * @return void |
||
187 | */ |
||
188 | public function setCompany($company) |
||
189 | { |
||
190 | $this->company = $company; |
||
191 | } |
||
192 | |||
193 | /** |
||
194 | * @return string|null |
||
195 | */ |
||
196 | public function getCompany() |
||
197 | { |
||
198 | return $this->company; |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * @param string $country |
||
203 | * |
||
204 | * @return void |
||
205 | */ |
||
206 | public function setCountry($country) |
||
207 | { |
||
208 | $this->country = $country; |
||
209 | } |
||
210 | |||
211 | /** |
||
212 | * @return string |
||
213 | */ |
||
214 | public function getCountry() |
||
215 | { |
||
216 | return $this->country; |
||
217 | } |
||
218 | |||
219 | /** |
||
220 | * @param string $customerid |
||
221 | * |
||
222 | * @return void |
||
223 | */ |
||
224 | public function setCustomerId($customerid) |
||
225 | { |
||
226 | $this->customerid = $customerid; |
||
227 | } |
||
228 | |||
229 | /** |
||
230 | * @return string |
||
231 | */ |
||
232 | public function getCustomerId() |
||
233 | { |
||
234 | return $this->customerid; |
||
235 | } |
||
236 | |||
237 | /** |
||
238 | * @param string $email |
||
239 | * |
||
240 | * @return void |
||
241 | */ |
||
242 | public function setEmail($email) |
||
243 | { |
||
244 | $this->email = $email; |
||
245 | } |
||
246 | |||
247 | /** |
||
248 | * @return string|null |
||
249 | */ |
||
250 | public function getEmail() |
||
251 | { |
||
252 | return $this->email; |
||
253 | } |
||
254 | |||
255 | /** |
||
256 | * @param string $firstname |
||
257 | * |
||
258 | * @return void |
||
259 | */ |
||
260 | public function setFirstName($firstname) |
||
261 | { |
||
262 | $this->firstname = $firstname; |
||
263 | } |
||
264 | |||
265 | /** |
||
266 | * @return string|null |
||
267 | */ |
||
268 | public function getFirstName() |
||
269 | { |
||
270 | return $this->firstname; |
||
271 | } |
||
272 | |||
273 | /** |
||
274 | * @param string $ip |
||
275 | * |
||
276 | * @return void |
||
277 | */ |
||
278 | public function setIp($ip) |
||
279 | { |
||
280 | $this->ip = $ip; |
||
281 | } |
||
282 | |||
283 | /** |
||
284 | * @return string|null |
||
285 | */ |
||
286 | public function getIp() |
||
287 | { |
||
288 | return $this->ip; |
||
289 | } |
||
290 | |||
291 | /** |
||
292 | * @param string $language |
||
293 | * |
||
294 | * @return void |
||
295 | */ |
||
296 | public function setLanguage($language) |
||
297 | { |
||
298 | $this->language = $language; |
||
299 | } |
||
300 | |||
301 | /** |
||
302 | * @return string |
||
303 | */ |
||
304 | public function getLanguage() |
||
305 | { |
||
306 | return $this->language; |
||
307 | } |
||
308 | |||
309 | /** |
||
310 | * @param string $lastname |
||
311 | * |
||
312 | * @return void |
||
313 | */ |
||
314 | public function setLastName($lastname) |
||
315 | { |
||
316 | $this->lastname = $lastname; |
||
317 | } |
||
318 | |||
319 | /** |
||
320 | * @return string|null |
||
321 | */ |
||
322 | public function getLastName() |
||
323 | { |
||
324 | return $this->lastname; |
||
325 | } |
||
326 | |||
327 | /** |
||
328 | * @param string $salutation |
||
329 | * |
||
330 | * @return void |
||
331 | */ |
||
332 | public function setSalutation($salutation) |
||
333 | { |
||
334 | $this->salutation = $salutation; |
||
335 | } |
||
336 | |||
337 | /** |
||
338 | * @return string|null |
||
339 | */ |
||
340 | public function getSalutation() |
||
341 | { |
||
342 | return $this->salutation; |
||
343 | } |
||
344 | |||
345 | /** |
||
346 | * @param string $state |
||
347 | * |
||
348 | * @return void |
||
349 | */ |
||
350 | public function setState($state) |
||
351 | { |
||
352 | $this->state = $state; |
||
353 | } |
||
354 | |||
355 | /** |
||
356 | * @return string|null |
||
357 | */ |
||
358 | public function getState() |
||
359 | { |
||
360 | return $this->state; |
||
361 | } |
||
362 | |||
363 | /** |
||
364 | * @param string $street |
||
365 | * |
||
366 | * @return void |
||
367 | */ |
||
368 | public function setStreet($street) |
||
369 | { |
||
370 | $this->street = $street; |
||
371 | } |
||
372 | |||
373 | /** |
||
374 | * @return string|null |
||
375 | */ |
||
376 | public function getStreet() |
||
377 | { |
||
378 | return $this->street; |
||
379 | } |
||
380 | |||
381 | /** |
||
382 | * @param string $telephonenumber |
||
383 | * |
||
384 | * @return void |
||
385 | */ |
||
386 | public function setTelephoneNumber($telephonenumber) |
||
387 | { |
||
388 | $this->telephonenumber = $telephonenumber; |
||
389 | } |
||
390 | |||
391 | /** |
||
392 | * @return string|null |
||
393 | */ |
||
394 | public function getTelephoneNumber() |
||
395 | { |
||
396 | return $this->telephonenumber; |
||
397 | } |
||
398 | |||
399 | /** |
||
400 | * @param string $title |
||
401 | * |
||
402 | * @return void |
||
403 | */ |
||
404 | public function setTitle($title) |
||
405 | { |
||
406 | $this->title = $title; |
||
407 | } |
||
408 | |||
409 | /** |
||
410 | * @return string |
||
411 | */ |
||
412 | public function getTitle() |
||
413 | { |
||
414 | return $this->title; |
||
415 | } |
||
416 | |||
417 | /** |
||
418 | * @param string $userid |
||
419 | * |
||
420 | * @return void |
||
421 | */ |
||
422 | public function setUserId($userid) |
||
423 | { |
||
424 | $this->userid = $userid; |
||
425 | } |
||
426 | |||
427 | /** |
||
428 | * @return string |
||
429 | */ |
||
430 | public function getUserId() |
||
431 | { |
||
432 | return $this->userid; |
||
433 | } |
||
434 | |||
435 | /** |
||
436 | * @param string $vatid |
||
437 | * |
||
438 | * @return void |
||
439 | */ |
||
440 | public function setVatId($vatid) |
||
441 | { |
||
442 | $this->vatid = $vatid; |
||
443 | } |
||
444 | |||
445 | /** |
||
446 | * @return string |
||
447 | */ |
||
448 | public function getVatId() |
||
449 | { |
||
450 | return $this->vatid; |
||
451 | } |
||
452 | |||
453 | /** |
||
454 | * @param string $gender |
||
455 | * |
||
456 | * @return void |
||
457 | */ |
||
458 | public function setGender($gender) |
||
459 | { |
||
460 | $this->gender = $gender; |
||
461 | } |
||
462 | |||
463 | /** |
||
464 | * @return string |
||
465 | */ |
||
466 | public function getGender() |
||
467 | { |
||
468 | return $this->gender; |
||
469 | } |
||
470 | |||
471 | /** |
||
472 | * @param string $personalId |
||
473 | * |
||
474 | * @return void |
||
475 | */ |
||
476 | public function setPersonalId($personalId) |
||
477 | { |
||
478 | $this->personalId = $personalId; |
||
479 | } |
||
480 | |||
481 | /** |
||
482 | * @return string |
||
483 | */ |
||
484 | public function getPersonalId() |
||
487 | } |
||
488 | |||
489 | /** |
||
490 | * @param string $zip |
||
491 | * |
||
492 | * @return void |
||
493 | */ |
||
494 | public function setZip($zip) |
||
495 | { |
||
496 | $this->zip = $zip; |
||
497 | } |
||
498 | |||
499 | /** |
||
500 | * @return string |
||
501 | */ |
||
502 | public function getZip() |
||
505 | } |
||
506 | } |
||
507 |