Complex classes like Payone_TransactionStatus_Request 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 Payone_TransactionStatus_Request, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
32 | class Payone_TransactionStatus_Request extends Payone_TransactionStatus_Request_Abstract |
||
|
|||
33 | { |
||
34 | /** |
||
35 | * @var string Payment portal key as MD5 value |
||
36 | */ |
||
37 | protected $key = NULL; |
||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $txaction = NULL; |
||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $mode = NULL; |
||
46 | /** |
||
47 | * @var int Payment portal ID |
||
48 | */ |
||
49 | protected $portalid = NULL; |
||
50 | /** |
||
51 | * @var int Account ID (subaccount ID) |
||
52 | */ |
||
53 | protected $aid = NULL; |
||
54 | /** * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $clearingtype = NULL; |
||
58 | /** |
||
59 | * unix timestamp |
||
60 | * |
||
61 | * @var int |
||
62 | */ |
||
63 | protected $txtime = NULL; |
||
64 | /** |
||
65 | * @var string ISO-4217 |
||
66 | */ |
||
67 | protected $currency = NULL; |
||
68 | /** |
||
69 | * @var int |
||
70 | */ |
||
71 | protected $userid = NULL; |
||
72 | /** |
||
73 | * @var int |
||
74 | */ |
||
75 | protected $customerid = NULL; |
||
76 | /** |
||
77 | * @var string |
||
78 | */ |
||
79 | protected $param = NULL; |
||
80 | |||
81 | // Parameter bei einer Statusmeldung eines Zahlungsvorgangs |
||
82 | |||
83 | /** |
||
84 | * @var int |
||
85 | */ |
||
86 | protected $txid = NULL; |
||
87 | /** |
||
88 | * @var string |
||
89 | */ |
||
90 | protected $reference = NULL; |
||
91 | /** |
||
92 | * @var string |
||
93 | */ |
||
94 | protected $sequencenumber = NULL; |
||
95 | /** |
||
96 | * @var string |
||
97 | */ |
||
98 | protected $receivable = NULL; |
||
99 | /** |
||
100 | * @var string |
||
101 | */ |
||
102 | protected $balance = NULL; |
||
103 | /** |
||
104 | * @var string |
||
105 | */ |
||
106 | protected $transaction_status = NULL; |
||
107 | /** |
||
108 | * @var string |
||
109 | */ |
||
110 | protected $failedcause = NULL; |
||
111 | /** |
||
112 | * @var string |
||
113 | */ |
||
114 | protected $reasoncode = NULL; |
||
115 | |||
116 | // Zusätzliche Parameter Contract bei Statusmeldung eines Zahlungsvorgangs |
||
117 | |||
118 | /** |
||
119 | * @var int |
||
120 | */ |
||
121 | protected $productid = NULL; |
||
122 | /** |
||
123 | * @var int |
||
124 | */ |
||
125 | protected $accessid = NULL; |
||
126 | |||
127 | // Zusätzliche Parameter Collect (txaction=reminder) bei Statusmeldung eines Zahlungsvorgangs |
||
128 | |||
129 | /** |
||
130 | * @var string |
||
131 | */ |
||
132 | protected $reminderlevel = NULL; |
||
133 | |||
134 | // Parameter Invoicing (txaction=invoice) |
||
135 | |||
136 | /** |
||
137 | * @var string |
||
138 | */ |
||
139 | protected $invoiceid = NULL; |
||
140 | /** |
||
141 | * @var string |
||
142 | */ |
||
143 | protected $invoice_grossamount = NULL; |
||
144 | /** |
||
145 | * @var string |
||
146 | */ |
||
147 | protected $invoice_date = NULL; |
||
148 | /** |
||
149 | * @var string |
||
150 | */ |
||
151 | protected $invoice_deliverydate = NULL; |
||
152 | /** |
||
153 | * @var string |
||
154 | */ |
||
155 | protected $invoice_deliveryenddate = NULL; |
||
156 | |||
157 | |||
158 | /** |
||
159 | * @var string |
||
160 | */ |
||
161 | protected $clearing_bankaccountholder = NULL; |
||
162 | /** |
||
163 | * @var string |
||
164 | */ |
||
165 | protected $clearing_bankcountry = NULL; |
||
166 | /** |
||
167 | * @var string |
||
168 | */ |
||
169 | protected $clearing_bankaccount = NULL; |
||
170 | /** |
||
171 | * @var string |
||
172 | */ |
||
173 | protected $clearing_bankcode = NULL; |
||
174 | /** |
||
175 | * @var string |
||
176 | */ |
||
177 | protected $clearing_bankiban = NULL; |
||
178 | /** |
||
179 | * @var string |
||
180 | */ |
||
181 | protected $clearing_bankbic = NULL; |
||
182 | /** |
||
183 | * @var string |
||
184 | */ |
||
185 | protected $clearing_bankcity = NULL; |
||
186 | /** |
||
187 | * @var string |
||
188 | */ |
||
189 | protected $clearing_bankname = NULL; |
||
190 | |||
191 | |||
192 | /** @var string */ |
||
193 | protected $clearing_legalnote = NULL; |
||
194 | |||
195 | /** |
||
196 | * (YYYYMMDD) |
||
197 | * @var string |
||
198 | */ |
||
199 | protected $clearing_duedate = NULL; |
||
200 | |||
201 | /** @var string */ |
||
202 | protected $clearing_reference = NULL; |
||
203 | |||
204 | /** @var string */ |
||
205 | protected $clearing_instructionnote = NULL; |
||
206 | |||
207 | /** |
||
208 | * @var string |
||
209 | */ |
||
210 | protected $iban = NULL; |
||
211 | /** |
||
212 | * @var string |
||
213 | */ |
||
214 | protected $bic = NULL; |
||
215 | /** |
||
216 | * @var string |
||
217 | */ |
||
218 | protected $mandate_identification = NULL; |
||
219 | /** |
||
220 | * @var string |
||
221 | */ |
||
222 | protected $creditor_identifier = NULL; |
||
223 | /** |
||
224 | * Format YYYYMMDD |
||
225 | * @var int |
||
226 | */ |
||
227 | protected $clearing_date = NULL; |
||
228 | /** |
||
229 | * @var float |
||
230 | */ |
||
231 | protected $clearing_amount = NULL; |
||
232 | |||
233 | |||
234 | /** |
||
235 | * @param int $accessid |
||
236 | */ |
||
237 | public function setAccessid($accessid) |
||
241 | |||
242 | /** |
||
243 | * @return int |
||
244 | */ |
||
245 | public function getAccessid() |
||
249 | |||
250 | /** |
||
251 | * @param int $aid |
||
252 | */ |
||
253 | public function setAid($aid) |
||
257 | |||
258 | /** |
||
259 | * @return int |
||
260 | */ |
||
261 | public function getAid() |
||
265 | |||
266 | /** |
||
267 | * @param string $balance |
||
268 | */ |
||
269 | public function setBalance($balance) |
||
273 | |||
274 | /** |
||
275 | * @return string |
||
276 | */ |
||
277 | public function getBalance() |
||
281 | |||
282 | /** |
||
283 | * @param string $clearingtype |
||
284 | */ |
||
285 | public function setClearingtype($clearingtype) |
||
289 | |||
290 | /** |
||
291 | * @return string |
||
292 | */ |
||
293 | public function getClearingtype() |
||
297 | |||
298 | /** |
||
299 | * @param string $currency |
||
300 | */ |
||
301 | public function setCurrency($currency) |
||
305 | |||
306 | /** |
||
307 | * @return string |
||
308 | */ |
||
309 | public function getCurrency() |
||
313 | |||
314 | /** |
||
315 | * @param int $customerid |
||
316 | */ |
||
317 | public function setCustomerid($customerid) |
||
321 | |||
322 | /** |
||
323 | * @return int |
||
324 | */ |
||
325 | public function getCustomerid() |
||
329 | |||
330 | /** |
||
331 | * @param string $transaction_status |
||
332 | */ |
||
333 | public function setTransactionStatus($transaction_status) |
||
337 | |||
338 | /** |
||
339 | * @return string |
||
340 | */ |
||
341 | public function getTransactionStatus() |
||
345 | |||
346 | /** |
||
347 | * @param string $failedcause |
||
348 | */ |
||
349 | public function setFailedcause($failedcause) |
||
353 | |||
354 | /** |
||
355 | * @return string |
||
356 | */ |
||
357 | public function getFailedcause() |
||
361 | |||
362 | /** |
||
363 | * @param string $reasoncode |
||
364 | */ |
||
365 | public function setReasoncode($reasoncode) |
||
369 | |||
370 | /** |
||
371 | * @return string |
||
372 | */ |
||
373 | public function getReasoncode() |
||
377 | |||
378 | /** |
||
379 | * @param string $invoice_date |
||
380 | */ |
||
381 | public function setInvoiceDate($invoice_date) |
||
385 | |||
386 | /** |
||
387 | * @return string |
||
388 | */ |
||
389 | public function getInvoiceDate() |
||
393 | |||
394 | /** |
||
395 | * @param string $invoice_deliverydate |
||
396 | */ |
||
397 | public function setInvoiceDeliverydate($invoice_deliverydate) |
||
401 | |||
402 | /** |
||
403 | * @return string |
||
404 | */ |
||
405 | public function getInvoiceDeliverydate() |
||
409 | |||
410 | /** |
||
411 | * @param string $invoice_deliveryenddate |
||
412 | */ |
||
413 | public function setInvoiceDeliveryenddate($invoice_deliveryenddate) |
||
417 | |||
418 | /** |
||
419 | * @return string |
||
420 | */ |
||
421 | public function getInvoiceDeliveryenddate() |
||
425 | |||
426 | /** |
||
427 | * @param string $invoice_grossamount |
||
428 | */ |
||
429 | public function setInvoiceGrossamount($invoice_grossamount) |
||
433 | |||
434 | /** |
||
435 | * @return string |
||
436 | */ |
||
437 | public function getInvoiceGrossamount() |
||
441 | |||
442 | /** |
||
443 | * @param string $invoiceid |
||
444 | */ |
||
445 | public function setInvoiceid($invoiceid) |
||
449 | |||
450 | /** |
||
451 | * @return string |
||
452 | */ |
||
453 | public function getInvoiceid() |
||
457 | |||
458 | /** |
||
459 | * @param string $key |
||
460 | */ |
||
461 | public function setKey($key) |
||
465 | |||
466 | /** |
||
467 | * @return string |
||
468 | */ |
||
469 | public function getKey() |
||
473 | |||
474 | /** |
||
475 | * @param string $mode |
||
476 | */ |
||
477 | public function setMode($mode) |
||
481 | |||
482 | /** |
||
483 | * @return string |
||
484 | */ |
||
485 | public function getMode() |
||
489 | |||
490 | /** |
||
491 | * @param string $param |
||
492 | */ |
||
493 | public function setParam($param) |
||
497 | |||
498 | /** |
||
499 | * @return string |
||
500 | */ |
||
501 | public function getParam() |
||
505 | |||
506 | /** |
||
507 | * @param int $portalid |
||
508 | */ |
||
509 | public function setPortalid($portalid) |
||
513 | |||
514 | /** |
||
515 | * @return int |
||
516 | */ |
||
517 | public function getPortalid() |
||
521 | |||
522 | /** |
||
523 | * @param int $productid |
||
524 | */ |
||
525 | public function setProductid($productid) |
||
529 | |||
530 | /** |
||
531 | * @return int |
||
532 | */ |
||
533 | public function getProductid() |
||
537 | |||
538 | /** |
||
539 | * @param string $receivable |
||
540 | */ |
||
541 | public function setReceivable($receivable) |
||
545 | |||
546 | /** |
||
547 | * @return string |
||
548 | */ |
||
549 | public function getReceivable() |
||
553 | |||
554 | /** |
||
555 | * @param string $reference |
||
556 | */ |
||
557 | public function setReference($reference) |
||
561 | |||
562 | /** |
||
563 | * @return string |
||
564 | */ |
||
565 | public function getReference() |
||
569 | |||
570 | /** |
||
571 | * @param string $reminderlevel |
||
572 | */ |
||
573 | public function setReminderlevel($reminderlevel) |
||
577 | |||
578 | /** |
||
579 | * @return string |
||
580 | */ |
||
581 | public function getReminderlevel() |
||
585 | |||
586 | /** |
||
587 | * @param string $sequencenumber |
||
588 | */ |
||
589 | public function setSequencenumber($sequencenumber) |
||
593 | |||
594 | /** |
||
595 | * @return string |
||
596 | */ |
||
597 | public function getSequencenumber() |
||
601 | |||
602 | /** |
||
603 | * @param string $txaction |
||
604 | */ |
||
605 | public function setTxaction($txaction) |
||
609 | |||
610 | /** |
||
611 | * @return string |
||
612 | */ |
||
613 | public function getTxaction() |
||
617 | |||
618 | /** |
||
619 | * @param int $txid |
||
620 | */ |
||
621 | public function setTxid($txid) |
||
625 | |||
626 | /** |
||
627 | * @return int |
||
628 | */ |
||
629 | public function getTxid() |
||
633 | |||
634 | /** |
||
635 | * @param int $txtime |
||
636 | */ |
||
637 | public function setTxtime($txtime) |
||
641 | |||
642 | /** |
||
643 | * @return int |
||
644 | */ |
||
645 | public function getTxtime() |
||
649 | |||
650 | /** |
||
651 | * @param int $userid |
||
652 | */ |
||
653 | public function setUserid($userid) |
||
657 | |||
658 | /** |
||
659 | * @return int |
||
660 | */ |
||
661 | public function getUserid() |
||
665 | |||
666 | /** |
||
667 | * @param string $clearing_bankaccount |
||
668 | */ |
||
669 | public function setClearingBankaccount( $clearing_bankaccount) |
||
673 | |||
674 | /** |
||
675 | * @return string |
||
676 | */ |
||
677 | public function getClearingBankaccount() |
||
681 | |||
682 | /** |
||
683 | * @param string $clearing_bankaccountholder |
||
684 | */ |
||
685 | public function setClearingBankaccountholder( $clearing_bankaccountholder) |
||
689 | |||
690 | /** |
||
691 | * @return string |
||
692 | */ |
||
693 | public function getClearingBankaccountholder() |
||
697 | |||
698 | /** |
||
699 | * @param string $clearing_bankbic |
||
700 | */ |
||
701 | public function setClearingBankbic( $clearing_bankbic) |
||
705 | |||
706 | /** |
||
707 | * @return string |
||
708 | */ |
||
709 | public function getClearingBankbic() |
||
713 | |||
714 | /** |
||
715 | * @param string $clearing_bankcity |
||
716 | */ |
||
717 | public function setClearingBankcity( $clearing_bankcity) |
||
721 | |||
722 | /** |
||
723 | * @return string |
||
724 | */ |
||
725 | public function getClearingBankcity() |
||
729 | |||
730 | /** |
||
731 | * @param string $clearing_bankcode |
||
732 | */ |
||
733 | public function setClearingBankcode( $clearing_bankcode) |
||
737 | |||
738 | /** |
||
739 | * @return string |
||
740 | */ |
||
741 | public function getClearingBankcode() |
||
745 | |||
746 | /** |
||
747 | * @param string $clearing_bankcountry |
||
748 | */ |
||
749 | public function setClearingBankcountry( $clearing_bankcountry) |
||
753 | |||
754 | /** |
||
755 | * @return string |
||
756 | */ |
||
757 | public function getClearingBankcountry() |
||
761 | |||
762 | /** |
||
763 | * @param string $clearing_bankiban |
||
764 | */ |
||
765 | public function setClearingBankiban( $clearing_bankiban) |
||
769 | |||
770 | /** |
||
771 | * @return string |
||
772 | */ |
||
773 | public function getClearingBankiban() |
||
777 | |||
778 | /** |
||
779 | * @param string $clearing_bankname |
||
780 | */ |
||
781 | public function setClearingBankname( $clearing_bankname) |
||
785 | |||
786 | /** |
||
787 | * @return string |
||
788 | */ |
||
789 | public function getClearingBankname() |
||
793 | |||
794 | /** |
||
795 | * @param string $clearing_duedate |
||
796 | */ |
||
797 | public function setClearingDuedate( $clearing_duedate) |
||
801 | |||
802 | /** |
||
803 | * @return string |
||
804 | */ |
||
805 | public function getClearingDuedate() |
||
809 | |||
810 | /** |
||
811 | * @param string $clearing_instructionnote |
||
812 | */ |
||
813 | public function setClearingInstructionnote( $clearing_instructionnote) |
||
817 | |||
818 | /** |
||
819 | * @return string |
||
820 | */ |
||
821 | public function getClearingInstructionnote() |
||
825 | |||
826 | /** |
||
827 | * @param string $clearing_legalnote |
||
828 | */ |
||
829 | public function setClearingLegalnote( $clearing_legalnote) |
||
833 | |||
834 | /** |
||
835 | * @return string |
||
836 | */ |
||
837 | public function getClearingLegalnote() |
||
841 | |||
842 | /** |
||
843 | * @param string $clearing_reference |
||
844 | */ |
||
845 | public function setClearingReference( $clearing_reference) |
||
849 | |||
850 | /** |
||
851 | * @return string |
||
852 | */ |
||
853 | public function getClearingReference() |
||
857 | |||
858 | /** |
||
859 | * @param string $iban |
||
860 | */ |
||
861 | public function setIban($iban) |
||
865 | |||
866 | /** |
||
867 | * @return string |
||
868 | */ |
||
869 | public function getIban() |
||
873 | |||
874 | /** |
||
875 | * @param string $bic |
||
876 | */ |
||
877 | public function setBic($bic) |
||
881 | |||
882 | /** |
||
883 | * @return string |
||
884 | */ |
||
885 | public function getBic() |
||
889 | |||
890 | /** |
||
891 | * @param string $mandateIdentification |
||
892 | */ |
||
893 | public function setMandateIdentification($mandateIdentification) |
||
897 | |||
898 | /** |
||
899 | * @return string |
||
900 | */ |
||
901 | public function getMandateIdentification() |
||
905 | |||
906 | /** |
||
907 | * @param string $creditorIdentifier |
||
908 | */ |
||
909 | public function setCreditorIdentifier($creditorIdentifier) |
||
913 | |||
914 | /** |
||
915 | * @return string |
||
916 | */ |
||
917 | public function getCreditorIdentifier() |
||
921 | |||
922 | /** |
||
923 | * @param int $clearingDate |
||
924 | */ |
||
925 | public function setClearingDate($clearingDate) |
||
929 | |||
930 | /** |
||
931 | * @return int |
||
932 | */ |
||
933 | public function getClearingDate() |
||
937 | |||
938 | /** |
||
939 | * @param float $clearingAmount |
||
940 | */ |
||
941 | public function setClearingAmount($clearingAmount) |
||
945 | |||
946 | /** |
||
947 | * @return float |
||
948 | */ |
||
949 | public function getClearingAmount() |
||
953 | } |
||
954 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.