Complex classes like BankwireDirectPayIn 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 BankwireDirectPayIn, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
15 | class BankwireDirectPayIn |
||
16 | { |
||
17 | private $tag; |
||
18 | |||
19 | private $authorId; |
||
20 | |||
21 | private $creditedWalletId; |
||
22 | |||
23 | private $creditedUserId; |
||
24 | |||
25 | private $declaredDebitedFundsCurrency; |
||
26 | |||
27 | private $declaredDebitedFundsAmount; |
||
28 | |||
29 | private $declaredFeesCurrency; |
||
30 | |||
31 | private $declaredFeesAmount; |
||
32 | |||
33 | private $status; |
||
34 | |||
35 | private $resultCode; |
||
36 | |||
37 | private $resultMessage; |
||
38 | |||
39 | private $type; |
||
40 | |||
41 | private $nature; |
||
42 | |||
43 | private $paymentType; |
||
44 | |||
45 | private $executionType; |
||
46 | |||
47 | private $wireReference; |
||
48 | |||
49 | private $bankAccountType; |
||
50 | |||
51 | private $bankAccountOwnerName; |
||
52 | |||
53 | private $bankAccountIban; |
||
54 | |||
55 | private $bankAccountBic; |
||
56 | |||
57 | /** |
||
58 | * @return mixed |
||
59 | */ |
||
60 | public function getTag() |
||
64 | |||
65 | /** |
||
66 | * @param mixed $tag |
||
67 | */ |
||
68 | public function setTag($tag) |
||
72 | |||
73 | /** |
||
74 | * @return mixed |
||
75 | */ |
||
76 | public function getAuthorId() |
||
80 | |||
81 | /** |
||
82 | * @param mixed $authorId |
||
83 | */ |
||
84 | public function setAuthorId($authorId) |
||
88 | |||
89 | /** |
||
90 | * @return mixed |
||
91 | */ |
||
92 | public function getCreditedWalletId() |
||
96 | |||
97 | /** |
||
98 | * @param mixed $creditedWalletId |
||
99 | */ |
||
100 | public function setCreditedWalletId($creditedWalletId) |
||
104 | |||
105 | /** |
||
106 | * @return mixed |
||
107 | */ |
||
108 | public function getCreditedUserId() |
||
112 | |||
113 | /** |
||
114 | * @param mixed $creditedUserId |
||
115 | */ |
||
116 | public function setCreditedUserId($creditedUserId) |
||
120 | |||
121 | /** |
||
122 | * @return mixed |
||
123 | */ |
||
124 | public function getDeclaredDebitedFundsCurrency() |
||
128 | |||
129 | /** |
||
130 | * @param mixed $declaredDebitedFundsCurrency |
||
131 | */ |
||
132 | public function setDeclaredDebitedFundsCurrency($declaredDebitedFundsCurrency) |
||
136 | |||
137 | /** |
||
138 | * @return mixed |
||
139 | */ |
||
140 | public function getDeclaredDebitedFundsAmount() |
||
144 | |||
145 | /** |
||
146 | * @param mixed $declaredDebitedFundsAmount |
||
147 | */ |
||
148 | public function setDeclaredDebitedFundsAmount($declaredDebitedFundsAmount) |
||
152 | |||
153 | /** |
||
154 | * @return mixed |
||
155 | */ |
||
156 | public function getDeclaredFeesCurrency() |
||
160 | |||
161 | /** |
||
162 | * @param mixed $declaredFeesCurrency |
||
163 | */ |
||
164 | public function setDeclaredFeesCurrency($declaredFeesCurrency) |
||
168 | |||
169 | /** |
||
170 | * @return mixed |
||
171 | */ |
||
172 | public function getDeclaredFeesAmount() |
||
176 | |||
177 | /** |
||
178 | * @param mixed $declaredFeesAmount |
||
179 | */ |
||
180 | public function setDeclaredFeesAmount($declaredFeesAmount) |
||
184 | |||
185 | /** |
||
186 | * @return mixed |
||
187 | */ |
||
188 | public function getStatus() |
||
192 | |||
193 | /** |
||
194 | * @param mixed $status |
||
195 | */ |
||
196 | public function setStatus($status) |
||
200 | |||
201 | /** |
||
202 | * @return mixed |
||
203 | */ |
||
204 | public function getResultCode() |
||
208 | |||
209 | /** |
||
210 | * @param mixed $resultCode |
||
211 | */ |
||
212 | public function setResultCode($resultCode) |
||
216 | |||
217 | /** |
||
218 | * @return mixed |
||
219 | */ |
||
220 | public function getResultMessage() |
||
224 | |||
225 | /** |
||
226 | * @param mixed $resultMessage |
||
227 | */ |
||
228 | public function setResultMessage($resultMessage) |
||
232 | |||
233 | /** |
||
234 | * @return mixed |
||
235 | */ |
||
236 | public function getType() |
||
240 | |||
241 | /** |
||
242 | * @param mixed $type |
||
243 | */ |
||
244 | public function setType($type) |
||
248 | |||
249 | /** |
||
250 | * @return mixed |
||
251 | */ |
||
252 | public function getNature() |
||
256 | |||
257 | /** |
||
258 | * @param mixed $nature |
||
259 | */ |
||
260 | public function setNature($nature) |
||
264 | |||
265 | /** |
||
266 | * @return mixed |
||
267 | */ |
||
268 | public function getPaymentType() |
||
272 | |||
273 | /** |
||
274 | * @param mixed $paymentType |
||
275 | */ |
||
276 | public function setPaymentType($paymentType) |
||
280 | |||
281 | /** |
||
282 | * @return mixed |
||
283 | */ |
||
284 | public function getExecutionType() |
||
288 | |||
289 | /** |
||
290 | * @param mixed $executionType |
||
291 | */ |
||
292 | public function setExecutionType($executionType) |
||
296 | |||
297 | /** |
||
298 | * @return mixed |
||
299 | */ |
||
300 | public function getWireReference() |
||
304 | |||
305 | /** |
||
306 | * @param mixed $wireReference |
||
307 | */ |
||
308 | public function setWireReference($wireReference) |
||
312 | |||
313 | /** |
||
314 | * @return mixed |
||
315 | */ |
||
316 | public function getBankAccountType() |
||
320 | |||
321 | /** |
||
322 | * @param mixed $bankAccountType |
||
323 | */ |
||
324 | public function setBankAccountType($bankAccountType) |
||
328 | |||
329 | /** |
||
330 | * @return mixed |
||
331 | */ |
||
332 | public function getBankAccountOwnerName() |
||
336 | |||
337 | /** |
||
338 | * @param mixed $bankAccountOwnerName |
||
339 | */ |
||
340 | public function setBankAccountOwnerName($bankAccountOwnerName) |
||
344 | |||
345 | /** |
||
346 | * @return mixed |
||
347 | */ |
||
348 | public function getBankAccountIban() |
||
352 | |||
353 | /** |
||
354 | * @param mixed $bankAccountIban |
||
355 | */ |
||
356 | public function setBankAccountIban($bankAccountIban) |
||
360 | |||
361 | /** |
||
362 | * @return mixed |
||
363 | */ |
||
364 | public function getBankAccountBic() |
||
368 | |||
369 | /** |
||
370 | * @param mixed $bankAccountBic |
||
371 | */ |
||
372 | public function setBankAccountBic($bankAccountBic) |
||
376 | } |
||
377 |