Complex classes like GetSingleUnitStayValueBackToBack 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 GetSingleUnitStayValueBackToBack, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 5 | class GetSingleUnitStayValueBackToBack |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var int $intGUID |
||
| 10 | */ |
||
| 11 | protected $intGUID = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string $strISOLanguage |
||
| 15 | */ |
||
| 16 | protected $strISOLanguage = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var int $intRoomType |
||
| 20 | */ |
||
| 21 | protected $intRoomType = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var int $intRateID |
||
| 25 | */ |
||
| 26 | protected $intRateID = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var int $ID_PromoCode |
||
| 30 | */ |
||
| 31 | protected $ID_PromoCode = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var int $intGuestCount |
||
| 35 | */ |
||
| 36 | protected $intGuestCount = null; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var string $strChildren |
||
| 40 | */ |
||
| 41 | protected $strChildren = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var \DateTime $dArrDate |
||
| 45 | */ |
||
| 46 | protected $dArrDate = null; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var \DateTime $dDepDate |
||
| 50 | */ |
||
| 51 | protected $dDepDate = null; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var string $strAttributes |
||
| 55 | */ |
||
| 56 | protected $strAttributes = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var string $strLocations |
||
| 60 | */ |
||
| 61 | protected $strLocations = null; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var dstElements $dstElements |
||
| 65 | */ |
||
| 66 | protected $dstElements = null; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var int $intRoomQty |
||
| 70 | */ |
||
| 71 | protected $intRoomQty = null; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var boolean $IsInsuranceAccepted |
||
| 75 | */ |
||
| 76 | protected $IsInsuranceAccepted = null; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var string $strAttributeGroupings |
||
| 80 | */ |
||
| 81 | protected $strAttributeGroupings = null; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var string $strLocationsGroupings |
||
| 85 | */ |
||
| 86 | protected $strLocationsGroupings = null; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var boolean $isRBO |
||
| 90 | */ |
||
| 91 | protected $isRBO = null; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var boolean $MustEvaluateRBO |
||
| 95 | */ |
||
| 96 | protected $MustEvaluateRBO = null; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var string $StrListSpecialOffertApplicable |
||
| 100 | */ |
||
| 101 | protected $StrListSpecialOffertApplicable = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var XMLDailyManualRates $XMLDailyManualRates |
||
| 105 | */ |
||
| 106 | protected $XMLDailyManualRates = null; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var string $XMLDailyRates |
||
| 110 | */ |
||
| 111 | protected $XMLDailyRates = null; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @var string $XMLServicesChargesALaCarte |
||
| 115 | */ |
||
| 116 | protected $XMLServicesChargesALaCarte = null; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @var int $ID_Room |
||
| 120 | */ |
||
| 121 | protected $ID_Room = null; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @var int $ID_Building |
||
| 125 | */ |
||
| 126 | protected $ID_Building = null; |
||
| 127 | |||
| 128 | /** |
||
| 129 | * @var string $strRateSpecial |
||
| 130 | */ |
||
| 131 | protected $strRateSpecial = null; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @var IAB2BMode $BackToBackMode |
||
| 135 | */ |
||
| 136 | protected $BackToBackMode = null; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @var int $intBusinessSourceID |
||
| 140 | */ |
||
| 141 | protected $intBusinessSourceID = null; |
||
| 142 | |||
| 143 | /** |
||
| 144 | * @param int $intGUID |
||
| 145 | * @param string $strISOLanguage |
||
| 146 | * @param int $intRoomType |
||
| 147 | * @param int $intRateID |
||
| 148 | * @param int $ID_PromoCode |
||
| 149 | * @param int $intGuestCount |
||
| 150 | * @param string $strChildren |
||
| 151 | * @param \DateTime $dArrDate |
||
| 152 | * @param \DateTime $dDepDate |
||
| 153 | * @param string $strAttributes |
||
| 154 | * @param string $strLocations |
||
| 155 | * @param dstElements $dstElements |
||
| 156 | * @param int $intRoomQty |
||
| 157 | * @param boolean $IsInsuranceAccepted |
||
| 158 | * @param string $strAttributeGroupings |
||
| 159 | * @param string $strLocationsGroupings |
||
| 160 | * @param boolean $isRBO |
||
| 161 | * @param boolean $MustEvaluateRBO |
||
| 162 | * @param string $StrListSpecialOffertApplicable |
||
| 163 | * @param XMLDailyManualRates $XMLDailyManualRates |
||
| 164 | * @param string $XMLDailyRates |
||
| 165 | * @param string $XMLServicesChargesALaCarte |
||
| 166 | * @param int $ID_Room |
||
| 167 | * @param int $ID_Building |
||
| 168 | * @param string $strRateSpecial |
||
| 169 | * @param IAB2BMode $BackToBackMode |
||
| 170 | * @param int $intBusinessSourceID |
||
| 171 | */ |
||
| 172 | public function __construct($intGUID, $strISOLanguage, $intRoomType, $intRateID, $ID_PromoCode, $intGuestCount, $strChildren, \DateTime $dArrDate, \DateTime $dDepDate, $strAttributes, $strLocations, $dstElements, $intRoomQty, $IsInsuranceAccepted, $strAttributeGroupings, $strLocationsGroupings, $isRBO, $MustEvaluateRBO, $StrListSpecialOffertApplicable, $XMLDailyManualRates, $XMLDailyRates, $XMLServicesChargesALaCarte, $ID_Room, $ID_Building, $strRateSpecial, $BackToBackMode, $intBusinessSourceID) |
||
| 202 | |||
| 203 | /** |
||
| 204 | * @return int |
||
| 205 | */ |
||
| 206 | public function getIntGUID() |
||
| 210 | |||
| 211 | /** |
||
| 212 | * @param int $intGUID |
||
| 213 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 214 | */ |
||
| 215 | public function setIntGUID($intGUID) |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @return string |
||
| 223 | */ |
||
| 224 | public function getStrISOLanguage() |
||
| 228 | |||
| 229 | /** |
||
| 230 | * @param string $strISOLanguage |
||
| 231 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 232 | */ |
||
| 233 | public function setStrISOLanguage($strISOLanguage) |
||
| 238 | |||
| 239 | /** |
||
| 240 | * @return int |
||
| 241 | */ |
||
| 242 | public function getIntRoomType() |
||
| 246 | |||
| 247 | /** |
||
| 248 | * @param int $intRoomType |
||
| 249 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 250 | */ |
||
| 251 | public function setIntRoomType($intRoomType) |
||
| 256 | |||
| 257 | /** |
||
| 258 | * @return int |
||
| 259 | */ |
||
| 260 | public function getIntRateID() |
||
| 264 | |||
| 265 | /** |
||
| 266 | * @param int $intRateID |
||
| 267 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 268 | */ |
||
| 269 | public function setIntRateID($intRateID) |
||
| 274 | |||
| 275 | /** |
||
| 276 | * @return int |
||
| 277 | */ |
||
| 278 | public function getID_PromoCode() |
||
| 282 | |||
| 283 | /** |
||
| 284 | * @param int $ID_PromoCode |
||
| 285 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 286 | */ |
||
| 287 | public function setID_PromoCode($ID_PromoCode) |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @return int |
||
| 295 | */ |
||
| 296 | public function getIntGuestCount() |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @param int $intGuestCount |
||
| 303 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 304 | */ |
||
| 305 | public function setIntGuestCount($intGuestCount) |
||
| 310 | |||
| 311 | /** |
||
| 312 | * @return string |
||
| 313 | */ |
||
| 314 | public function getStrChildren() |
||
| 318 | |||
| 319 | /** |
||
| 320 | * @param string $strChildren |
||
| 321 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 322 | */ |
||
| 323 | public function setStrChildren($strChildren) |
||
| 328 | |||
| 329 | /** |
||
| 330 | * @return \DateTime |
||
| 331 | */ |
||
| 332 | public function getDArrDate() |
||
| 344 | |||
| 345 | /** |
||
| 346 | * @param \DateTime $dArrDate |
||
| 347 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 348 | */ |
||
| 349 | public function setDArrDate(\DateTime $dArrDate) |
||
| 354 | |||
| 355 | /** |
||
| 356 | * @return \DateTime |
||
| 357 | */ |
||
| 358 | public function getDDepDate() |
||
| 370 | |||
| 371 | /** |
||
| 372 | * @param \DateTime $dDepDate |
||
| 373 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 374 | */ |
||
| 375 | public function setDDepDate(\DateTime $dDepDate) |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @return string |
||
| 383 | */ |
||
| 384 | public function getStrAttributes() |
||
| 388 | |||
| 389 | /** |
||
| 390 | * @param string $strAttributes |
||
| 391 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 392 | */ |
||
| 393 | public function setStrAttributes($strAttributes) |
||
| 398 | |||
| 399 | /** |
||
| 400 | * @return string |
||
| 401 | */ |
||
| 402 | public function getStrLocations() |
||
| 406 | |||
| 407 | /** |
||
| 408 | * @param string $strLocations |
||
| 409 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 410 | */ |
||
| 411 | public function setStrLocations($strLocations) |
||
| 416 | |||
| 417 | /** |
||
| 418 | * @return dstElements |
||
| 419 | */ |
||
| 420 | public function getDstElements() |
||
| 424 | |||
| 425 | /** |
||
| 426 | * @param dstElements $dstElements |
||
| 427 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 428 | */ |
||
| 429 | public function setDstElements($dstElements) |
||
| 434 | |||
| 435 | /** |
||
| 436 | * @return int |
||
| 437 | */ |
||
| 438 | public function getIntRoomQty() |
||
| 442 | |||
| 443 | /** |
||
| 444 | * @param int $intRoomQty |
||
| 445 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 446 | */ |
||
| 447 | public function setIntRoomQty($intRoomQty) |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return boolean |
||
| 455 | */ |
||
| 456 | public function getIsInsuranceAccepted() |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @param boolean $IsInsuranceAccepted |
||
| 463 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 464 | */ |
||
| 465 | public function setIsInsuranceAccepted($IsInsuranceAccepted) |
||
| 470 | |||
| 471 | /** |
||
| 472 | * @return string |
||
| 473 | */ |
||
| 474 | public function getStrAttributeGroupings() |
||
| 478 | |||
| 479 | /** |
||
| 480 | * @param string $strAttributeGroupings |
||
| 481 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 482 | */ |
||
| 483 | public function setStrAttributeGroupings($strAttributeGroupings) |
||
| 488 | |||
| 489 | /** |
||
| 490 | * @return string |
||
| 491 | */ |
||
| 492 | public function getStrLocationsGroupings() |
||
| 496 | |||
| 497 | /** |
||
| 498 | * @param string $strLocationsGroupings |
||
| 499 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 500 | */ |
||
| 501 | public function setStrLocationsGroupings($strLocationsGroupings) |
||
| 506 | |||
| 507 | /** |
||
| 508 | * @return boolean |
||
| 509 | */ |
||
| 510 | public function getIsRBO() |
||
| 514 | |||
| 515 | /** |
||
| 516 | * @param boolean $isRBO |
||
| 517 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 518 | */ |
||
| 519 | public function setIsRBO($isRBO) |
||
| 524 | |||
| 525 | /** |
||
| 526 | * @return boolean |
||
| 527 | */ |
||
| 528 | public function getMustEvaluateRBO() |
||
| 532 | |||
| 533 | /** |
||
| 534 | * @param boolean $MustEvaluateRBO |
||
| 535 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 536 | */ |
||
| 537 | public function setMustEvaluateRBO($MustEvaluateRBO) |
||
| 542 | |||
| 543 | /** |
||
| 544 | * @return string |
||
| 545 | */ |
||
| 546 | public function getStrListSpecialOffertApplicable() |
||
| 550 | |||
| 551 | /** |
||
| 552 | * @param string $StrListSpecialOffertApplicable |
||
| 553 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 554 | */ |
||
| 555 | public function setStrListSpecialOffertApplicable($StrListSpecialOffertApplicable) |
||
| 560 | |||
| 561 | /** |
||
| 562 | * @return XMLDailyManualRates |
||
| 563 | */ |
||
| 564 | public function getXMLDailyManualRates() |
||
| 568 | |||
| 569 | /** |
||
| 570 | * @param XMLDailyManualRates $XMLDailyManualRates |
||
| 571 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 572 | */ |
||
| 573 | public function setXMLDailyManualRates($XMLDailyManualRates) |
||
| 578 | |||
| 579 | /** |
||
| 580 | * @return string |
||
| 581 | */ |
||
| 582 | public function getXMLDailyRates() |
||
| 586 | |||
| 587 | /** |
||
| 588 | * @param string $XMLDailyRates |
||
| 589 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 590 | */ |
||
| 591 | public function setXMLDailyRates($XMLDailyRates) |
||
| 596 | |||
| 597 | /** |
||
| 598 | * @return string |
||
| 599 | */ |
||
| 600 | public function getXMLServicesChargesALaCarte() |
||
| 604 | |||
| 605 | /** |
||
| 606 | * @param string $XMLServicesChargesALaCarte |
||
| 607 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 608 | */ |
||
| 609 | public function setXMLServicesChargesALaCarte($XMLServicesChargesALaCarte) |
||
| 614 | |||
| 615 | /** |
||
| 616 | * @return int |
||
| 617 | */ |
||
| 618 | public function getID_Room() |
||
| 622 | |||
| 623 | /** |
||
| 624 | * @param int $ID_Room |
||
| 625 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 626 | */ |
||
| 627 | public function setID_Room($ID_Room) |
||
| 632 | |||
| 633 | /** |
||
| 634 | * @return int |
||
| 635 | */ |
||
| 636 | public function getID_Building() |
||
| 640 | |||
| 641 | /** |
||
| 642 | * @param int $ID_Building |
||
| 643 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 644 | */ |
||
| 645 | public function setID_Building($ID_Building) |
||
| 650 | |||
| 651 | /** |
||
| 652 | * @return string |
||
| 653 | */ |
||
| 654 | public function getStrRateSpecial() |
||
| 658 | |||
| 659 | /** |
||
| 660 | * @param string $strRateSpecial |
||
| 661 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 662 | */ |
||
| 663 | public function setStrRateSpecial($strRateSpecial) |
||
| 668 | |||
| 669 | /** |
||
| 670 | * @return IAB2BMode |
||
| 671 | */ |
||
| 672 | public function getBackToBackMode() |
||
| 676 | |||
| 677 | /** |
||
| 678 | * @param IAB2BMode $BackToBackMode |
||
| 679 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 680 | */ |
||
| 681 | public function setBackToBackMode($BackToBackMode) |
||
| 686 | |||
| 687 | /** |
||
| 688 | * @return int |
||
| 689 | */ |
||
| 690 | public function getIntBusinessSourceID() |
||
| 694 | |||
| 695 | /** |
||
| 696 | * @param int $intBusinessSourceID |
||
| 697 | * @return \Gueststream\PMS\IQWare\API\GetSingleUnitStayValueBackToBack |
||
| 698 | */ |
||
| 699 | public function setIntBusinessSourceID($intBusinessSourceID) |
||
| 704 | } |
||
| 705 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..