Complex classes like Payone_Api_Response_Authorization_Abstract 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_Api_Response_Authorization_Abstract, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 33 | abstract class Payone_Api_Response_Authorization_Abstract |
||
|
|
|||
| 34 | extends Payone_Api_Response_Abstract |
||
| 35 | { |
||
| 36 | /** |
||
| 37 | * @var int |
||
| 38 | */ |
||
| 39 | protected $txid = NULL; |
||
| 40 | /** |
||
| 41 | * @var int |
||
| 42 | */ |
||
| 43 | protected $userid = NULL; |
||
| 44 | /** |
||
| 45 | * @var string |
||
| 46 | */ |
||
| 47 | protected $protect_result_avs = NULL; |
||
| 48 | /** |
||
| 49 | * @var string |
||
| 50 | */ |
||
| 51 | protected $clearing_bankaccountholder = NULL; |
||
| 52 | /** |
||
| 53 | * @var string |
||
| 54 | */ |
||
| 55 | protected $clearing_bankcountry = NULL; |
||
| 56 | /** |
||
| 57 | * @var string |
||
| 58 | */ |
||
| 59 | protected $clearing_bankaccount = NULL; |
||
| 60 | /** |
||
| 61 | * @var string |
||
| 62 | */ |
||
| 63 | protected $clearing_bankcode = NULL; |
||
| 64 | /** |
||
| 65 | * @var string |
||
| 66 | */ |
||
| 67 | protected $clearing_bankiban = NULL; |
||
| 68 | /** |
||
| 69 | * @var string |
||
| 70 | */ |
||
| 71 | protected $clearing_bankbic = NULL; |
||
| 72 | /** |
||
| 73 | * @var string |
||
| 74 | */ |
||
| 75 | protected $clearing_bankcity = NULL; |
||
| 76 | /** |
||
| 77 | * @var string |
||
| 78 | */ |
||
| 79 | protected $clearing_bankname = NULL; |
||
| 80 | /** |
||
| 81 | * @var string |
||
| 82 | */ |
||
| 83 | protected $mandate_identification = NULL; |
||
| 84 | /** |
||
| 85 | * @var string |
||
| 86 | */ |
||
| 87 | protected $paydata_content_encoding = NULL; |
||
| 88 | /** |
||
| 89 | * @var string |
||
| 90 | */ |
||
| 91 | protected $paydata_instruction_notes = NULL; |
||
| 92 | /** |
||
| 93 | * @var string |
||
| 94 | */ |
||
| 95 | protected $paydata_content_format = NULL; |
||
| 96 | /** |
||
| 97 | * @var string |
||
| 98 | */ |
||
| 99 | protected $clearing_instructionnote = NULL; |
||
| 100 | /** |
||
| 101 | * @var string |
||
| 102 | */ |
||
| 103 | protected $clearing_reference = NULL; |
||
| 104 | /** |
||
| 105 | * @var string |
||
| 106 | */ |
||
| 107 | protected $clearing_legalnote = NULL; |
||
| 108 | /** |
||
| 109 | * @var string |
||
| 110 | */ |
||
| 111 | protected $clearing_duedate = NULL; |
||
| 112 | /** |
||
| 113 | * @var string |
||
| 114 | */ |
||
| 115 | protected $paydata_clearing_reference = NULL; |
||
| 116 | /** |
||
| 117 | * @var string |
||
| 118 | */ |
||
| 119 | protected $paydata_workorderid = NULL; |
||
| 120 | /** |
||
| 121 | * @var string |
||
| 122 | */ |
||
| 123 | protected $paydata_reservation_txid = NULL; |
||
| 124 | |||
| 125 | /** |
||
| 126 | * @param string $clearing_bankaccount |
||
| 127 | */ |
||
| 128 | public function setClearingBankaccount($clearing_bankaccount) |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @return string |
||
| 135 | */ |
||
| 136 | public function getClearingBankaccount() |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @param string $clearing_bankaccountholder |
||
| 143 | */ |
||
| 144 | public function setClearingBankaccountholder($clearing_bankaccountholder) |
||
| 148 | |||
| 149 | /** |
||
| 150 | * @return string |
||
| 151 | */ |
||
| 152 | public function getClearingBankaccountholder() |
||
| 156 | |||
| 157 | /** |
||
| 158 | * @param string $clearing_bankbic |
||
| 159 | */ |
||
| 160 | public function setClearingBankbic($clearing_bankbic) |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @return string |
||
| 167 | */ |
||
| 168 | public function getClearingBankbic() |
||
| 172 | |||
| 173 | /** |
||
| 174 | * @param string $clearing_bankcity |
||
| 175 | */ |
||
| 176 | public function setClearingBankcity($clearing_bankcity) |
||
| 180 | |||
| 181 | /** |
||
| 182 | * @return string |
||
| 183 | */ |
||
| 184 | public function getClearingBankcity() |
||
| 188 | |||
| 189 | /** |
||
| 190 | * @param string $clearing_bankcode |
||
| 191 | */ |
||
| 192 | public function setClearingBankcode($clearing_bankcode) |
||
| 196 | |||
| 197 | /** |
||
| 198 | * @return string |
||
| 199 | */ |
||
| 200 | public function getClearingBankcode() |
||
| 204 | |||
| 205 | /** |
||
| 206 | * @param string $clearing_bankcountry |
||
| 207 | */ |
||
| 208 | public function setClearingBankcountry($clearing_bankcountry) |
||
| 212 | |||
| 213 | /** |
||
| 214 | * @return string |
||
| 215 | */ |
||
| 216 | public function getClearingBankcountry() |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @param string $clearing_bankiban |
||
| 223 | */ |
||
| 224 | public function setClearingBankiban($clearing_bankiban) |
||
| 228 | |||
| 229 | /** |
||
| 230 | * @return string |
||
| 231 | */ |
||
| 232 | public function getClearingBankiban() |
||
| 236 | |||
| 237 | /** |
||
| 238 | * @param string $clearing_bankname |
||
| 239 | */ |
||
| 240 | public function setClearingBankname($clearing_bankname) |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @return string |
||
| 247 | */ |
||
| 248 | public function getClearingBankname() |
||
| 252 | |||
| 253 | /** |
||
| 254 | * @param string $protect_result_avs |
||
| 255 | */ |
||
| 256 | public function setProtectResultAvs($protect_result_avs) |
||
| 260 | |||
| 261 | /** |
||
| 262 | * @return string |
||
| 263 | */ |
||
| 264 | public function getProtectResultAvs() |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @param int $txid |
||
| 271 | */ |
||
| 272 | public function setTxid($txid) |
||
| 276 | |||
| 277 | /** |
||
| 278 | * @return int |
||
| 279 | */ |
||
| 280 | public function getTxid() |
||
| 284 | |||
| 285 | /** |
||
| 286 | * @param int $userid |
||
| 287 | */ |
||
| 288 | public function setUserid($userid) |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @return int |
||
| 295 | */ |
||
| 296 | public function getUserid() |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @param string $mandateIdentification |
||
| 303 | */ |
||
| 304 | public function setMandateIdentification($mandateIdentification) |
||
| 308 | |||
| 309 | /** |
||
| 310 | * @return string |
||
| 311 | */ |
||
| 312 | public function getMandateIdentification() |
||
| 316 | |||
| 317 | /** |
||
| 318 | * @param string $sContentEncoding |
||
| 319 | */ |
||
| 320 | public function setAddPaydataContentEncoding($sContentEncoding) |
||
| 324 | |||
| 325 | /** |
||
| 326 | * @return string |
||
| 327 | */ |
||
| 328 | public function getAddPaydataContentEncoding() |
||
| 332 | |||
| 333 | /** |
||
| 334 | * @param string $sInstructionNotes |
||
| 335 | */ |
||
| 336 | public function setAddPaydataInstructionNotes($sInstructionNotes) |
||
| 340 | |||
| 341 | /** |
||
| 342 | * @return string |
||
| 343 | */ |
||
| 344 | public function getAddPaydataInstructionNotes() |
||
| 348 | |||
| 349 | /** |
||
| 350 | * @param string $sContentFormat |
||
| 351 | */ |
||
| 352 | public function setAddPaydataContentFormat($sContentFormat) |
||
| 356 | |||
| 357 | /** |
||
| 358 | * @return string |
||
| 359 | */ |
||
| 360 | public function getAddPaydataContentFormat() |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @param string $clearing_instructionnote |
||
| 367 | */ |
||
| 368 | public function setClearingInstructionnote($clearing_instructionnote) |
||
| 372 | |||
| 373 | /** |
||
| 374 | * @return string |
||
| 375 | */ |
||
| 376 | public function getClearingInstructionnote() |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @param string $clearing_reference |
||
| 383 | */ |
||
| 384 | public function setClearingReference($clearing_reference) |
||
| 388 | |||
| 389 | /** |
||
| 390 | * @return string |
||
| 391 | */ |
||
| 392 | public function getClearingReference() |
||
| 396 | |||
| 397 | /** |
||
| 398 | * @param string $clearing_legalnote |
||
| 399 | */ |
||
| 400 | public function setClearingLegalnote($clearing_legalnote) |
||
| 404 | |||
| 405 | /** |
||
| 406 | * @return string |
||
| 407 | */ |
||
| 408 | public function getClearingLegalnote() |
||
| 412 | |||
| 413 | /** |
||
| 414 | * @param string $clearing_duedate |
||
| 415 | */ |
||
| 416 | public function setClearingDuedate($clearing_duedate) |
||
| 420 | |||
| 421 | /** |
||
| 422 | * @return string |
||
| 423 | */ |
||
| 424 | public function getClearingDuedate() |
||
| 428 | |||
| 429 | /** |
||
| 430 | * @return string |
||
| 431 | */ |
||
| 432 | public function getAddPaydataClearingReference() |
||
| 436 | |||
| 437 | /** |
||
| 438 | * @param $sClearingReference |
||
| 439 | */ |
||
| 440 | public function setAddPaydataClearingReference($sClearingReference) |
||
| 444 | |||
| 445 | /** |
||
| 446 | * @return string |
||
| 447 | */ |
||
| 448 | public function getAddPaydataWorkorderid() |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @param string $paydata_workorderid |
||
| 455 | */ |
||
| 456 | public function setAddPaydataWorkorderid($paydata_workorderid) |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @return string |
||
| 463 | */ |
||
| 464 | public function getAddPaydataReservationTxid() |
||
| 468 | |||
| 469 | /** |
||
| 470 | * @param string $paydata_reservation_txid |
||
| 471 | */ |
||
| 472 | public function setAddPaydataReservationTxid($paydata_reservation_txid) |
||
| 476 | |||
| 477 | } |
||
| 478 |
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.