Complex classes like Payment 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 Payment, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
9 | class Payment |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $apiKey; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $merchant; |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | protected $orderId; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $sessionId; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $currencySymbol; |
||
35 | |||
36 | /** |
||
37 | * @var Money |
||
38 | */ |
||
39 | protected $totalAmount; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $callBackUrl; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $fullCallBackOkUrl; |
||
50 | |||
51 | /** |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $callBackOkUrl; |
||
55 | |||
56 | /** |
||
57 | * @var string |
||
58 | */ |
||
59 | protected $callBackServerUrl; |
||
60 | |||
61 | /** |
||
62 | * @var int |
||
63 | */ |
||
64 | protected $languageId; |
||
65 | |||
66 | /** |
||
67 | * @var bool |
||
68 | */ |
||
69 | protected $testMode; |
||
70 | |||
71 | /** |
||
72 | * @var int |
||
73 | */ |
||
74 | protected $paymentGatewayCurrencyCode; |
||
75 | |||
76 | /** |
||
77 | * @var int |
||
78 | */ |
||
79 | protected $cardTypeId; |
||
80 | |||
81 | /** |
||
82 | * @var string |
||
83 | */ |
||
84 | protected $customerRekvNr; |
||
85 | |||
86 | /** |
||
87 | * @var string |
||
88 | */ |
||
89 | protected $customerName; |
||
90 | |||
91 | /** |
||
92 | * @var string |
||
93 | */ |
||
94 | protected $customerCompany; |
||
95 | |||
96 | /** |
||
97 | * @var string |
||
98 | */ |
||
99 | protected $customerAddress; |
||
100 | |||
101 | /** |
||
102 | * @var string |
||
103 | */ |
||
104 | protected $customerAddress2; |
||
105 | |||
106 | /** |
||
107 | * @var string |
||
108 | */ |
||
109 | protected $customerZipCode; |
||
110 | |||
111 | /** |
||
112 | * @var string |
||
113 | */ |
||
114 | protected $customerCity; |
||
115 | |||
116 | /** |
||
117 | * @var int |
||
118 | */ |
||
119 | protected $customerCountryId; |
||
120 | |||
121 | /** |
||
122 | * @var string |
||
123 | */ |
||
124 | protected $customerCountry; |
||
125 | |||
126 | /** |
||
127 | * This is the ISO 3166 country code |
||
128 | * |
||
129 | * @var string |
||
130 | */ |
||
131 | protected $customerCountryCode; |
||
132 | |||
133 | /** |
||
134 | * @var string |
||
135 | */ |
||
136 | protected $customerPhone; |
||
137 | |||
138 | /** |
||
139 | * @var string |
||
140 | */ |
||
141 | protected $customerFax; |
||
142 | |||
143 | /** |
||
144 | * @var string |
||
145 | */ |
||
146 | protected $customerEmail; |
||
147 | |||
148 | /** |
||
149 | * @var string |
||
150 | */ |
||
151 | protected $customerNote; |
||
152 | |||
153 | /** |
||
154 | * @var string |
||
155 | */ |
||
156 | protected $customerCvrnr; |
||
157 | |||
158 | /** |
||
159 | * @var int |
||
160 | */ |
||
161 | protected $customerCustTypeId; |
||
162 | |||
163 | /** |
||
164 | * @var string |
||
165 | */ |
||
166 | protected $customerEan; |
||
167 | |||
168 | /** |
||
169 | * @var string |
||
170 | */ |
||
171 | protected $customerRes1; |
||
172 | |||
173 | /** |
||
174 | * @var string |
||
175 | */ |
||
176 | protected $customerRes2; |
||
177 | |||
178 | /** |
||
179 | * @var string |
||
180 | */ |
||
181 | protected $customerRes3; |
||
182 | |||
183 | /** |
||
184 | * @var string |
||
185 | */ |
||
186 | protected $customerRes4; |
||
187 | |||
188 | /** |
||
189 | * @var string |
||
190 | */ |
||
191 | protected $customerRes5; |
||
192 | |||
193 | /** |
||
194 | * @var string |
||
195 | */ |
||
196 | protected $customerIp; |
||
197 | |||
198 | /** |
||
199 | * @var string |
||
200 | */ |
||
201 | protected $deliveryName; |
||
202 | |||
203 | /** |
||
204 | * @var string |
||
205 | */ |
||
206 | protected $deliveryCompany; |
||
207 | |||
208 | /** |
||
209 | * @var string |
||
210 | */ |
||
211 | protected $deliveryAddress; |
||
212 | |||
213 | /** |
||
214 | * @var string |
||
215 | */ |
||
216 | protected $deliveryAddress2; |
||
217 | |||
218 | /** |
||
219 | * @var string |
||
220 | */ |
||
221 | protected $deliveryZipCode; |
||
222 | |||
223 | /** |
||
224 | * @var string |
||
225 | */ |
||
226 | protected $deliveryCity; |
||
227 | |||
228 | /** |
||
229 | * @var int |
||
230 | */ |
||
231 | protected $deliveryCountryID; |
||
232 | |||
233 | /** |
||
234 | * @var string |
||
235 | */ |
||
236 | protected $deliveryCountry; |
||
237 | |||
238 | /** |
||
239 | * This is the ISO 3166 country code |
||
240 | * |
||
241 | * @var string |
||
242 | */ |
||
243 | protected $deliveryCountryCode; |
||
244 | |||
245 | /** |
||
246 | * @var string |
||
247 | */ |
||
248 | protected $deliveryPhone; |
||
249 | |||
250 | /** |
||
251 | * @var string |
||
252 | */ |
||
253 | protected $deliveryFax; |
||
254 | |||
255 | /** |
||
256 | * @var string |
||
257 | */ |
||
258 | protected $deliveryEmail; |
||
259 | |||
260 | /** |
||
261 | * @var string |
||
262 | */ |
||
263 | protected $deliveryEan; |
||
264 | |||
265 | /** |
||
266 | * @var string |
||
267 | */ |
||
268 | protected $shippingMethod; |
||
269 | |||
270 | /** |
||
271 | * @var int |
||
272 | */ |
||
273 | protected $shippingMethodId; |
||
274 | |||
275 | /** |
||
276 | * @var Money |
||
277 | */ |
||
278 | protected $shippingFee; |
||
279 | |||
280 | /** |
||
281 | * @var string |
||
282 | */ |
||
283 | protected $paymentMethod; |
||
284 | |||
285 | /** |
||
286 | * @var int |
||
287 | */ |
||
288 | protected $paymentMethodId; |
||
289 | |||
290 | /** |
||
291 | * @var Money |
||
292 | */ |
||
293 | protected $paymentFee; |
||
294 | |||
295 | /** |
||
296 | * @var string |
||
297 | */ |
||
298 | protected $loadBalancerRealIp; |
||
299 | |||
300 | /** |
||
301 | * @var string |
||
302 | */ |
||
303 | protected $referrer; |
||
304 | |||
305 | /** |
||
306 | * @var PaymentLine[] |
||
307 | */ |
||
308 | protected $paymentLines; |
||
309 | |||
310 | 18 | public function __construct() |
|
314 | |||
315 | 6 | public static function createFromRequest(ServerRequestInterface $request) : Payment |
|
321 | |||
322 | 6 | public function populateFromRequest(ServerRequestInterface $request) |
|
414 | |||
415 | 3 | public static function createPaymentLine(string $productNumber, string $name, int $quantity, Money $price, int $vat) |
|
419 | |||
420 | /** |
||
421 | * Takes strings like |
||
422 | * - 1.000,50 |
||
423 | * - 1,000.50 |
||
424 | * - 1000.50 |
||
425 | * - 1000,50. |
||
426 | * |
||
427 | * and returns 100050 |
||
428 | * |
||
429 | * @param string $str |
||
430 | * @param string $propertyPath |
||
431 | * |
||
432 | * @return int |
||
433 | */ |
||
434 | 9 | public static function priceStringToInt(string $str, string $propertyPath = '') : int |
|
447 | |||
448 | /** |
||
449 | * @return string |
||
450 | */ |
||
451 | 6 | public function getApiKey(): ?string |
|
455 | |||
456 | /** |
||
457 | * @param string $apiKey |
||
458 | * |
||
459 | * @return Payment |
||
460 | */ |
||
461 | 9 | public function setApiKey(string $apiKey): self |
|
467 | |||
468 | /** |
||
469 | * @return string |
||
470 | */ |
||
471 | 3 | public function getMerchant(): ?string |
|
475 | |||
476 | /** |
||
477 | * @param string $merchant |
||
478 | * |
||
479 | * @return Payment |
||
480 | */ |
||
481 | 6 | public function setMerchant(string $merchant): self |
|
487 | |||
488 | /** |
||
489 | * @return int |
||
490 | */ |
||
491 | 9 | public function getOrderId(): ?int |
|
495 | |||
496 | /** |
||
497 | * @param int $orderId |
||
498 | * |
||
499 | * @return Payment |
||
500 | */ |
||
501 | 12 | public function setOrderId(int $orderId): self |
|
507 | |||
508 | /** |
||
509 | * @return string |
||
510 | */ |
||
511 | 3 | public function getSessionId(): ?string |
|
515 | |||
516 | /** |
||
517 | * @param string $sessionId |
||
518 | * |
||
519 | * @return Payment |
||
520 | */ |
||
521 | 6 | public function setSessionId(string $sessionId): self |
|
527 | |||
528 | /** |
||
529 | * @return string |
||
530 | */ |
||
531 | 3 | public function getCurrencySymbol(): ?string |
|
535 | |||
536 | /** |
||
537 | * @param string $currencySymbol |
||
538 | * |
||
539 | * @return Payment |
||
540 | */ |
||
541 | 6 | public function setCurrencySymbol(string $currencySymbol): self |
|
547 | |||
548 | /** |
||
549 | * @return Money |
||
550 | */ |
||
551 | 9 | public function getTotalAmount(): ?Money |
|
555 | |||
556 | /** |
||
557 | * @param Money $totalAmount |
||
558 | * |
||
559 | * @return Payment |
||
560 | */ |
||
561 | 6 | public function setTotalAmount(Money $totalAmount): self |
|
567 | |||
568 | /** |
||
569 | * @return string |
||
570 | */ |
||
571 | 3 | public function getCallBackUrl(): ?string |
|
575 | |||
576 | /** |
||
577 | * @param string $callBackUrl |
||
578 | * |
||
579 | * @return Payment |
||
580 | */ |
||
581 | 6 | public function setCallBackUrl(string $callBackUrl): self |
|
587 | |||
588 | /** |
||
589 | * @return string |
||
590 | */ |
||
591 | 3 | public function getFullCallBackOkUrl(): ?string |
|
595 | |||
596 | /** |
||
597 | * @param string $fullCallBackOkUrl |
||
598 | * |
||
599 | * @return Payment |
||
600 | */ |
||
601 | 6 | public function setFullCallBackOkUrl(string $fullCallBackOkUrl): self |
|
607 | |||
608 | /** |
||
609 | * @return string |
||
610 | */ |
||
611 | 3 | public function getCallBackOkUrl(): ?string |
|
615 | |||
616 | /** |
||
617 | * @param string $callBackOkUrl |
||
618 | * |
||
619 | * @return Payment |
||
620 | */ |
||
621 | 6 | public function setCallBackOkUrl(string $callBackOkUrl): self |
|
627 | |||
628 | /** |
||
629 | * @return string |
||
630 | */ |
||
631 | 3 | public function getCallBackServerUrl(): ?string |
|
635 | |||
636 | /** |
||
637 | * @param string $callBackServerUrl |
||
638 | * |
||
639 | * @return Payment |
||
640 | */ |
||
641 | 6 | public function setCallBackServerUrl(string $callBackServerUrl): self |
|
647 | |||
648 | /** |
||
649 | * @return int |
||
650 | */ |
||
651 | 3 | public function getLanguageId(): ?int |
|
655 | |||
656 | /** |
||
657 | * @param int $languageId |
||
658 | * |
||
659 | * @return Payment |
||
660 | */ |
||
661 | 6 | public function setLanguageId(int $languageId): self |
|
667 | |||
668 | /** |
||
669 | * @return bool |
||
670 | */ |
||
671 | 3 | public function isTestMode(): ?bool |
|
675 | |||
676 | /** |
||
677 | * @param bool $testMode |
||
678 | * |
||
679 | * @return Payment |
||
680 | */ |
||
681 | 6 | public function setTestMode(bool $testMode): self |
|
687 | |||
688 | /** |
||
689 | * @return int |
||
690 | */ |
||
691 | 9 | public function getPaymentGatewayCurrencyCode() |
|
695 | |||
696 | /** |
||
697 | * @param int $paymentGatewayCurrencyCode |
||
698 | * |
||
699 | * @return Payment |
||
700 | */ |
||
701 | 12 | public function setPaymentGatewayCurrencyCode(int $paymentGatewayCurrencyCode): self |
|
707 | |||
708 | /** |
||
709 | * @return int |
||
710 | */ |
||
711 | 3 | public function getCardTypeId() |
|
715 | |||
716 | /** |
||
717 | * @param int $cardTypeId |
||
718 | * |
||
719 | * @return Payment |
||
720 | */ |
||
721 | 6 | public function setCardTypeId(int $cardTypeId): self |
|
727 | |||
728 | /** |
||
729 | * @return string |
||
730 | */ |
||
731 | 3 | public function getCustomerRekvNr(): ?string |
|
735 | |||
736 | /** |
||
737 | * @param string $customerRekvNr |
||
738 | * |
||
739 | * @return Payment |
||
740 | */ |
||
741 | 6 | public function setCustomerRekvNr(string $customerRekvNr): self |
|
747 | |||
748 | /** |
||
749 | * @return string |
||
750 | */ |
||
751 | 3 | public function getCustomerName(): ?string |
|
755 | |||
756 | /** |
||
757 | * @param string $customerName |
||
758 | * |
||
759 | * @return Payment |
||
760 | */ |
||
761 | 6 | public function setCustomerName(string $customerName): self |
|
767 | |||
768 | /** |
||
769 | * @return string |
||
770 | */ |
||
771 | 3 | public function getCustomerCompany(): ?string |
|
775 | |||
776 | /** |
||
777 | * @param string $customerCompany |
||
778 | * |
||
779 | * @return Payment |
||
780 | */ |
||
781 | 6 | public function setCustomerCompany(string $customerCompany): self |
|
787 | |||
788 | /** |
||
789 | * @return string |
||
790 | */ |
||
791 | 3 | public function getCustomerAddress(): ?string |
|
795 | |||
796 | /** |
||
797 | * @param string $customerAddress |
||
798 | * |
||
799 | * @return Payment |
||
800 | */ |
||
801 | 6 | public function setCustomerAddress(string $customerAddress): self |
|
807 | |||
808 | /** |
||
809 | * @return string |
||
810 | */ |
||
811 | 3 | public function getCustomerAddress2(): ?string |
|
815 | |||
816 | /** |
||
817 | * @param string $customerAddress2 |
||
818 | * |
||
819 | * @return Payment |
||
820 | */ |
||
821 | 6 | public function setCustomerAddress2(string $customerAddress2): self |
|
827 | |||
828 | /** |
||
829 | * @return string |
||
830 | */ |
||
831 | 3 | public function getCustomerZipCode(): ?string |
|
835 | |||
836 | /** |
||
837 | * @param string $customerZipCode |
||
838 | * |
||
839 | * @return Payment |
||
840 | */ |
||
841 | 6 | public function setCustomerZipCode(string $customerZipCode): self |
|
847 | |||
848 | /** |
||
849 | * @return string |
||
850 | */ |
||
851 | 3 | public function getCustomerCity(): ?string |
|
855 | |||
856 | /** |
||
857 | * @param string $customerCity |
||
858 | * |
||
859 | * @return Payment |
||
860 | */ |
||
861 | 6 | public function setCustomerCity(string $customerCity): self |
|
867 | |||
868 | /** |
||
869 | * @return int |
||
870 | */ |
||
871 | 3 | public function getCustomerCountryId() |
|
875 | |||
876 | /** |
||
877 | * @param int $customerCountryId |
||
878 | * |
||
879 | * @return Payment |
||
880 | */ |
||
881 | 6 | public function setCustomerCountryId(int $customerCountryId): self |
|
887 | |||
888 | /** |
||
889 | * @return string |
||
890 | */ |
||
891 | 3 | public function getCustomerCountry(): ?string |
|
895 | |||
896 | /** |
||
897 | * @param string $customerCountry |
||
898 | * |
||
899 | * @return Payment |
||
900 | */ |
||
901 | 6 | public function setCustomerCountry(string $customerCountry): self |
|
907 | |||
908 | /** |
||
909 | * @return string |
||
910 | */ |
||
911 | 3 | public function getCustomerCountryCode(): ?string |
|
915 | |||
916 | /** |
||
917 | * @param string $customerCountryCode |
||
918 | * @return Payment |
||
919 | */ |
||
920 | 6 | public function setCustomerCountryCode(string $customerCountryCode): self |
|
925 | |||
926 | /** |
||
927 | * @return string |
||
928 | */ |
||
929 | 3 | public function getCustomerPhone(): ?string |
|
933 | |||
934 | /** |
||
935 | * @param string $customerPhone |
||
936 | * |
||
937 | * @return Payment |
||
938 | */ |
||
939 | 6 | public function setCustomerPhone(string $customerPhone): self |
|
945 | |||
946 | /** |
||
947 | * @return string |
||
948 | */ |
||
949 | 3 | public function getCustomerFax(): ?string |
|
953 | |||
954 | /** |
||
955 | * @param string $customerFax |
||
956 | * |
||
957 | * @return Payment |
||
958 | */ |
||
959 | 6 | public function setCustomerFax(string $customerFax): self |
|
965 | |||
966 | /** |
||
967 | * @return string |
||
968 | */ |
||
969 | 3 | public function getCustomerEmail(): ?string |
|
973 | |||
974 | /** |
||
975 | * @param string $customerEmail |
||
976 | * |
||
977 | * @return Payment |
||
978 | */ |
||
979 | 6 | public function setCustomerEmail(string $customerEmail): self |
|
985 | |||
986 | /** |
||
987 | * @return string |
||
988 | */ |
||
989 | 3 | public function getCustomerNote(): ?string |
|
993 | |||
994 | /** |
||
995 | * @param string $customerNote |
||
996 | * |
||
997 | * @return Payment |
||
998 | */ |
||
999 | 6 | public function setCustomerNote(string $customerNote): self |
|
1005 | |||
1006 | /** |
||
1007 | * @return string |
||
1008 | */ |
||
1009 | 3 | public function getCustomerCvrnr(): ?string |
|
1013 | |||
1014 | /** |
||
1015 | * @param string $customerCvrnr |
||
1016 | * |
||
1017 | * @return Payment |
||
1018 | */ |
||
1019 | 6 | public function setCustomerCvrnr(string $customerCvrnr): self |
|
1025 | |||
1026 | /** |
||
1027 | * @return int |
||
1028 | */ |
||
1029 | 3 | public function getCustomerCustTypeId(): ?int |
|
1033 | |||
1034 | /** |
||
1035 | * @param int $customerCustTypeId |
||
1036 | * |
||
1037 | * @return Payment |
||
1038 | */ |
||
1039 | 6 | public function setCustomerCustTypeId(int $customerCustTypeId): self |
|
1045 | |||
1046 | /** |
||
1047 | * @return string |
||
1048 | */ |
||
1049 | 3 | public function getCustomerEan(): ?string |
|
1053 | |||
1054 | /** |
||
1055 | * @param string $customerEan |
||
1056 | * |
||
1057 | * @return Payment |
||
1058 | */ |
||
1059 | 6 | public function setCustomerEan(string $customerEan): self |
|
1065 | |||
1066 | /** |
||
1067 | * @return string |
||
1068 | */ |
||
1069 | 3 | public function getCustomerRes1(): ?string |
|
1073 | |||
1074 | /** |
||
1075 | * @param string $customerRes1 |
||
1076 | * |
||
1077 | * @return Payment |
||
1078 | */ |
||
1079 | 6 | public function setCustomerRes1(string $customerRes1): self |
|
1085 | |||
1086 | /** |
||
1087 | * @return string |
||
1088 | */ |
||
1089 | 3 | public function getCustomerRes2(): ?string |
|
1093 | |||
1094 | /** |
||
1095 | * @param string $customerRes2 |
||
1096 | * |
||
1097 | * @return Payment |
||
1098 | */ |
||
1099 | 6 | public function setCustomerRes2(string $customerRes2): self |
|
1105 | |||
1106 | /** |
||
1107 | * @return string |
||
1108 | */ |
||
1109 | 3 | public function getCustomerRes3(): ?string |
|
1113 | |||
1114 | /** |
||
1115 | * @param string $customerRes3 |
||
1116 | * |
||
1117 | * @return Payment |
||
1118 | */ |
||
1119 | 6 | public function setCustomerRes3(string $customerRes3): self |
|
1125 | |||
1126 | /** |
||
1127 | * @return string |
||
1128 | */ |
||
1129 | 3 | public function getCustomerRes4(): ?string |
|
1133 | |||
1134 | /** |
||
1135 | * @param string $customerRes4 |
||
1136 | * |
||
1137 | * @return Payment |
||
1138 | */ |
||
1139 | 6 | public function setCustomerRes4(string $customerRes4): self |
|
1145 | |||
1146 | /** |
||
1147 | * @return string |
||
1148 | */ |
||
1149 | 3 | public function getCustomerRes5(): ?string |
|
1153 | |||
1154 | /** |
||
1155 | * @param string $customerRes5 |
||
1156 | * |
||
1157 | * @return Payment |
||
1158 | */ |
||
1159 | 6 | public function setCustomerRes5(string $customerRes5): self |
|
1165 | |||
1166 | /** |
||
1167 | * @return string |
||
1168 | */ |
||
1169 | 3 | public function getCustomerIp(): ?string |
|
1173 | |||
1174 | /** |
||
1175 | * @param string $customerIp |
||
1176 | * |
||
1177 | * @return Payment |
||
1178 | */ |
||
1179 | 6 | public function setCustomerIp(string $customerIp): self |
|
1185 | |||
1186 | /** |
||
1187 | * @return string |
||
1188 | */ |
||
1189 | 3 | public function getDeliveryName(): ?string |
|
1193 | |||
1194 | /** |
||
1195 | * @param string $deliveryName |
||
1196 | * |
||
1197 | * @return Payment |
||
1198 | */ |
||
1199 | 6 | public function setDeliveryName(string $deliveryName): self |
|
1205 | |||
1206 | /** |
||
1207 | * @return string |
||
1208 | */ |
||
1209 | 3 | public function getDeliveryCompany(): ?string |
|
1213 | |||
1214 | /** |
||
1215 | * @param string $deliveryCompany |
||
1216 | * |
||
1217 | * @return Payment |
||
1218 | */ |
||
1219 | 6 | public function setDeliveryCompany(string $deliveryCompany): self |
|
1225 | |||
1226 | /** |
||
1227 | * @return string |
||
1228 | */ |
||
1229 | 3 | public function getDeliveryAddress(): ?string |
|
1233 | |||
1234 | /** |
||
1235 | * @param string $deliveryAddress |
||
1236 | * |
||
1237 | * @return Payment |
||
1238 | */ |
||
1239 | 6 | public function setDeliveryAddress(string $deliveryAddress): self |
|
1245 | |||
1246 | /** |
||
1247 | * @return string |
||
1248 | */ |
||
1249 | 3 | public function getDeliveryAddress2(): ?string |
|
1253 | |||
1254 | /** |
||
1255 | * @param string $deliveryAddress2 |
||
1256 | * |
||
1257 | * @return Payment |
||
1258 | */ |
||
1259 | 6 | public function setDeliveryAddress2(string $deliveryAddress2): self |
|
1265 | |||
1266 | /** |
||
1267 | * @return string |
||
1268 | */ |
||
1269 | 3 | public function getDeliveryZipCode(): ?string |
|
1273 | |||
1274 | /** |
||
1275 | * @param string $deliveryZipCode |
||
1276 | * |
||
1277 | * @return Payment |
||
1278 | */ |
||
1279 | 6 | public function setDeliveryZipCode(string $deliveryZipCode): self |
|
1285 | |||
1286 | /** |
||
1287 | * @return string |
||
1288 | */ |
||
1289 | 3 | public function getDeliveryCity(): ?string |
|
1293 | |||
1294 | /** |
||
1295 | * @param string $deliveryCity |
||
1296 | * |
||
1297 | * @return Payment |
||
1298 | */ |
||
1299 | 6 | public function setDeliveryCity(string $deliveryCity): self |
|
1305 | |||
1306 | /** |
||
1307 | * @return int |
||
1308 | */ |
||
1309 | 3 | public function getDeliveryCountryID() |
|
1313 | |||
1314 | /** |
||
1315 | * @param int $deliveryCountryID |
||
1316 | * |
||
1317 | * @return Payment |
||
1318 | */ |
||
1319 | 6 | public function setDeliveryCountryID(int $deliveryCountryID): self |
|
1325 | |||
1326 | /** |
||
1327 | * @return string |
||
1328 | */ |
||
1329 | 3 | public function getDeliveryCountry(): ?string |
|
1333 | |||
1334 | /** |
||
1335 | * @param string $deliveryCountry |
||
1336 | * |
||
1337 | * @return Payment |
||
1338 | */ |
||
1339 | 6 | public function setDeliveryCountry(string $deliveryCountry): self |
|
1345 | |||
1346 | /** |
||
1347 | * @return string |
||
1348 | */ |
||
1349 | 3 | public function getDeliveryCountryCode(): ?string |
|
1353 | |||
1354 | /** |
||
1355 | * @param string $deliveryCountryCode |
||
1356 | * @return Payment |
||
1357 | */ |
||
1358 | 6 | public function setDeliveryCountryCode(string $deliveryCountryCode) |
|
1363 | |||
1364 | /** |
||
1365 | * @return string |
||
1366 | */ |
||
1367 | 3 | public function getDeliveryPhone(): ?string |
|
1371 | |||
1372 | /** |
||
1373 | * @param string $deliveryPhone |
||
1374 | * |
||
1375 | * @return Payment |
||
1376 | */ |
||
1377 | 6 | public function setDeliveryPhone(string $deliveryPhone): self |
|
1383 | |||
1384 | /** |
||
1385 | * @return string |
||
1386 | */ |
||
1387 | 3 | public function getDeliveryFax(): ?string |
|
1391 | |||
1392 | /** |
||
1393 | * @param string $deliveryFax |
||
1394 | * |
||
1395 | * @return Payment |
||
1396 | */ |
||
1397 | 6 | public function setDeliveryFax(string $deliveryFax): self |
|
1403 | |||
1404 | /** |
||
1405 | * @return string |
||
1406 | */ |
||
1407 | 3 | public function getDeliveryEmail(): ?string |
|
1411 | |||
1412 | /** |
||
1413 | * @param string $deliveryEmail |
||
1414 | * |
||
1415 | * @return Payment |
||
1416 | */ |
||
1417 | 6 | public function setDeliveryEmail(string $deliveryEmail): self |
|
1423 | |||
1424 | /** |
||
1425 | * @return string |
||
1426 | */ |
||
1427 | 3 | public function getDeliveryEan(): ?string |
|
1431 | |||
1432 | /** |
||
1433 | * @param string $deliveryEan |
||
1434 | * |
||
1435 | * @return Payment |
||
1436 | */ |
||
1437 | 6 | public function setDeliveryEan(string $deliveryEan): self |
|
1443 | |||
1444 | /** |
||
1445 | * @return string |
||
1446 | */ |
||
1447 | 3 | public function getShippingMethod(): ?string |
|
1451 | |||
1452 | /** |
||
1453 | * @param string $shippingMethod |
||
1454 | * |
||
1455 | * @return Payment |
||
1456 | */ |
||
1457 | 6 | public function setShippingMethod(string $shippingMethod): self |
|
1463 | |||
1464 | /** |
||
1465 | * @return int |
||
1466 | */ |
||
1467 | 3 | public function getShippingMethodId(): ?int |
|
1471 | |||
1472 | /** |
||
1473 | * @param int $shippingMethodId |
||
1474 | * @return Payment |
||
1475 | */ |
||
1476 | 6 | public function setShippingMethodId(int $shippingMethodId) : self |
|
1481 | |||
1482 | /** |
||
1483 | * @return Money |
||
1484 | */ |
||
1485 | 3 | public function getShippingFee(): ?Money |
|
1489 | |||
1490 | /** |
||
1491 | * @param Money $shippingFee |
||
1492 | * |
||
1493 | * @return Payment |
||
1494 | */ |
||
1495 | 3 | public function setShippingFee(Money $shippingFee): self |
|
1501 | |||
1502 | /** |
||
1503 | * @return string |
||
1504 | */ |
||
1505 | 3 | public function getPaymentMethod(): ?string |
|
1509 | |||
1510 | /** |
||
1511 | * @param string $paymentMethod |
||
1512 | * |
||
1513 | * @return Payment |
||
1514 | */ |
||
1515 | 6 | public function setPaymentMethod(string $paymentMethod): self |
|
1521 | |||
1522 | /** |
||
1523 | * @return int |
||
1524 | */ |
||
1525 | 3 | public function getPaymentMethodId(): ?int |
|
1529 | |||
1530 | /** |
||
1531 | * @param int $paymentMethodId |
||
1532 | * @return Payment |
||
1533 | */ |
||
1534 | 6 | public function setPaymentMethodId(int $paymentMethodId) : self |
|
1539 | |||
1540 | /** |
||
1541 | * @return Money |
||
1542 | */ |
||
1543 | 3 | public function getPaymentFee(): ?Money |
|
1547 | |||
1548 | /** |
||
1549 | * @param Money $paymentFee |
||
1550 | * |
||
1551 | * @return Payment |
||
1552 | */ |
||
1553 | 3 | public function setPaymentFee(Money $paymentFee): self |
|
1559 | |||
1560 | /** |
||
1561 | * @return string |
||
1562 | */ |
||
1563 | 3 | public function getLoadBalancerRealIp(): ?string |
|
1567 | |||
1568 | /** |
||
1569 | * @param string $loadBalancerRealIp |
||
1570 | * |
||
1571 | * @return Payment |
||
1572 | */ |
||
1573 | 6 | public function setLoadBalancerRealIp(string $loadBalancerRealIp): self |
|
1579 | |||
1580 | /** |
||
1581 | * @return string |
||
1582 | */ |
||
1583 | 3 | public function getReferrer(): ?string |
|
1587 | |||
1588 | /** |
||
1589 | * @param string $referrer |
||
1590 | * |
||
1591 | * @return Payment |
||
1592 | */ |
||
1593 | 6 | public function setReferrer(string $referrer): self |
|
1599 | |||
1600 | /** |
||
1601 | * @return PaymentLine[]|iterable |
||
1602 | */ |
||
1603 | 6 | public function getPaymentLines(): iterable |
|
1607 | |||
1608 | /** |
||
1609 | * @param PaymentLine[]|iterable $paymentLines |
||
1610 | * |
||
1611 | * @return Payment |
||
1612 | */ |
||
1613 | 3 | public function setPaymentLines(iterable $paymentLines): self |
|
1619 | |||
1620 | /** |
||
1621 | * @param PaymentLine $paymentLine |
||
1622 | * |
||
1623 | * @return Payment |
||
1624 | */ |
||
1625 | 3 | public function addPaymentLine(PaymentLine $paymentLine): self |
|
1632 | |||
1633 | /** |
||
1634 | * Returns the default currency for this payment |
||
1635 | * |
||
1636 | * @return null|string |
||
1637 | */ |
||
1638 | 6 | protected function getCurrency() : ?string |
|
1642 | |||
1643 | /** |
||
1644 | * A helper method for creating a Money object from a float based on the shared currency |
||
1645 | * |
||
1646 | * @param int $amount |
||
1647 | * @return Money|null |
||
1648 | */ |
||
1649 | 6 | protected function createMoney(int $amount = 0) : ?Money |
|
1657 | |||
1658 | /** |
||
1659 | * A helper method for creating a Money object from a float based on the shared currency |
||
1660 | * |
||
1661 | * The float can be any format, i.e. 1.50 or 1,50 |
||
1662 | * |
||
1663 | * @param string $amount |
||
1664 | * @return Money|null |
||
1665 | */ |
||
1666 | 6 | protected function createMoneyFromFloat(string $amount = '0.00') : ?Money |
|
1671 | } |
||
1672 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: