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 $resourceId; |
||
| 18 | |||
| 19 | private $tag; |
||
| 20 | |||
| 21 | private $authorId; |
||
| 22 | |||
| 23 | private $creditedWalletId; |
||
| 24 | |||
| 25 | private $creditedUserId; |
||
| 26 | |||
| 27 | private $declaredDebitedFundsCurrency; |
||
| 28 | |||
| 29 | private $declaredDebitedFundsAmount; |
||
| 30 | |||
| 31 | private $declaredFeesCurrency; |
||
| 32 | |||
| 33 | private $declaredFeesAmount; |
||
| 34 | |||
| 35 | private $status; |
||
| 36 | |||
| 37 | private $resultCode; |
||
| 38 | |||
| 39 | private $resultMessage; |
||
| 40 | |||
| 41 | private $type; |
||
| 42 | |||
| 43 | private $nature; |
||
| 44 | |||
| 45 | private $paymentType; |
||
| 46 | |||
| 47 | private $executionType; |
||
| 48 | |||
| 49 | private $wireReference; |
||
| 50 | |||
| 51 | private $bankAccountType; |
||
| 52 | |||
| 53 | private $bankAccountOwnerName; |
||
| 54 | |||
| 55 | private $bankAccountIban; |
||
| 56 | |||
| 57 | private $bankAccountBic; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return mixed |
||
| 61 | */ |
||
| 62 | public function getTag() |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param mixed $tag |
||
| 69 | */ |
||
| 70 | public function setTag($tag) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return mixed |
||
| 77 | */ |
||
| 78 | public function getAuthorId() |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @param mixed $authorId |
||
| 85 | */ |
||
| 86 | public function setAuthorId($authorId) |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @return mixed |
||
| 93 | */ |
||
| 94 | public function getCreditedWalletId() |
||
| 98 | |||
| 99 | /** |
||
| 100 | * @param mixed $creditedWalletId |
||
| 101 | */ |
||
| 102 | public function setCreditedWalletId($creditedWalletId) |
||
| 106 | |||
| 107 | /** |
||
| 108 | * @return mixed |
||
| 109 | */ |
||
| 110 | public function getCreditedUserId() |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @param mixed $creditedUserId |
||
| 117 | */ |
||
| 118 | public function setCreditedUserId($creditedUserId) |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @return mixed |
||
| 125 | */ |
||
| 126 | public function getDeclaredDebitedFundsCurrency() |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @param mixed $declaredDebitedFundsCurrency |
||
| 133 | */ |
||
| 134 | public function setDeclaredDebitedFundsCurrency($declaredDebitedFundsCurrency) |
||
| 138 | |||
| 139 | /** |
||
| 140 | * @return mixed |
||
| 141 | */ |
||
| 142 | public function getDeclaredDebitedFundsAmount() |
||
| 146 | |||
| 147 | /** |
||
| 148 | * @param mixed $declaredDebitedFundsAmount |
||
| 149 | */ |
||
| 150 | public function setDeclaredDebitedFundsAmount($declaredDebitedFundsAmount) |
||
| 154 | |||
| 155 | /** |
||
| 156 | * @return mixed |
||
| 157 | */ |
||
| 158 | public function getDeclaredFeesCurrency() |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @param mixed $declaredFeesCurrency |
||
| 165 | */ |
||
| 166 | public function setDeclaredFeesCurrency($declaredFeesCurrency) |
||
| 170 | |||
| 171 | /** |
||
| 172 | * @return mixed |
||
| 173 | */ |
||
| 174 | public function getDeclaredFeesAmount() |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @param mixed $declaredFeesAmount |
||
| 181 | */ |
||
| 182 | public function setDeclaredFeesAmount($declaredFeesAmount) |
||
| 186 | |||
| 187 | /** |
||
| 188 | * @return mixed |
||
| 189 | */ |
||
| 190 | public function getStatus() |
||
| 194 | |||
| 195 | /** |
||
| 196 | * @param mixed $status |
||
| 197 | */ |
||
| 198 | public function setStatus($status) |
||
| 202 | |||
| 203 | /** |
||
| 204 | * @return mixed |
||
| 205 | */ |
||
| 206 | public function getResultCode() |
||
| 210 | |||
| 211 | /** |
||
| 212 | * @param mixed $resultCode |
||
| 213 | */ |
||
| 214 | public function setResultCode($resultCode) |
||
| 218 | |||
| 219 | /** |
||
| 220 | * @return mixed |
||
| 221 | */ |
||
| 222 | public function getResultMessage() |
||
| 226 | |||
| 227 | /** |
||
| 228 | * @param mixed $resultMessage |
||
| 229 | */ |
||
| 230 | public function setResultMessage($resultMessage) |
||
| 234 | |||
| 235 | /** |
||
| 236 | * @return mixed |
||
| 237 | */ |
||
| 238 | public function getType() |
||
| 242 | |||
| 243 | /** |
||
| 244 | * @param mixed $type |
||
| 245 | */ |
||
| 246 | public function setType($type) |
||
| 250 | |||
| 251 | /** |
||
| 252 | * @return mixed |
||
| 253 | */ |
||
| 254 | public function getNature() |
||
| 258 | |||
| 259 | /** |
||
| 260 | * @param mixed $nature |
||
| 261 | */ |
||
| 262 | public function setNature($nature) |
||
| 266 | |||
| 267 | /** |
||
| 268 | * @return mixed |
||
| 269 | */ |
||
| 270 | public function getPaymentType() |
||
| 274 | |||
| 275 | /** |
||
| 276 | * @param mixed $paymentType |
||
| 277 | */ |
||
| 278 | public function setPaymentType($paymentType) |
||
| 282 | |||
| 283 | /** |
||
| 284 | * @return mixed |
||
| 285 | */ |
||
| 286 | public function getExecutionType() |
||
| 290 | |||
| 291 | /** |
||
| 292 | * @param mixed $executionType |
||
| 293 | */ |
||
| 294 | public function setExecutionType($executionType) |
||
| 298 | |||
| 299 | /** |
||
| 300 | * @return mixed |
||
| 301 | */ |
||
| 302 | public function getWireReference() |
||
| 306 | |||
| 307 | /** |
||
| 308 | * @param mixed $wireReference |
||
| 309 | */ |
||
| 310 | public function setWireReference($wireReference) |
||
| 314 | |||
| 315 | /** |
||
| 316 | * @return mixed |
||
| 317 | */ |
||
| 318 | public function getBankAccountType() |
||
| 322 | |||
| 323 | /** |
||
| 324 | * @param mixed $bankAccountType |
||
| 325 | */ |
||
| 326 | public function setBankAccountType($bankAccountType) |
||
| 330 | |||
| 331 | /** |
||
| 332 | * @return mixed |
||
| 333 | */ |
||
| 334 | public function getBankAccountOwnerName() |
||
| 338 | |||
| 339 | /** |
||
| 340 | * @param mixed $bankAccountOwnerName |
||
| 341 | */ |
||
| 342 | public function setBankAccountOwnerName($bankAccountOwnerName) |
||
| 346 | |||
| 347 | /** |
||
| 348 | * @return mixed |
||
| 349 | */ |
||
| 350 | public function getBankAccountIban() |
||
| 354 | |||
| 355 | /** |
||
| 356 | * @param mixed $bankAccountIban |
||
| 357 | */ |
||
| 358 | public function setBankAccountIban($bankAccountIban) |
||
| 362 | |||
| 363 | /** |
||
| 364 | * @return mixed |
||
| 365 | */ |
||
| 366 | public function getBankAccountBic() |
||
| 370 | |||
| 371 | /** |
||
| 372 | * @param mixed $bankAccountBic |
||
| 373 | */ |
||
| 374 | public function setBankAccountBic($bankAccountBic) |
||
| 378 | |||
| 379 | /** |
||
| 380 | * @return mixed |
||
| 381 | */ |
||
| 382 | public function getResourceId() |
||
| 386 | |||
| 387 | /** |
||
| 388 | * @param mixed $resourceId |
||
| 389 | */ |
||
| 390 | public function setResourceId($resourceId) |
||
| 394 | } |
||
| 395 |