Complex classes like RoomAvailabilityForStay 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 RoomAvailabilityForStay, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 5 | class RoomAvailabilityForStay |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var int $ID_Room |
||
| 10 | */ |
||
| 11 | protected $ID_Room = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var int $ID_RoomType |
||
| 15 | */ |
||
| 16 | protected $ID_RoomType = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var int $ID_RoomTypeSuite |
||
| 20 | */ |
||
| 21 | protected $ID_RoomTypeSuite = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var int $ID_Building |
||
| 25 | */ |
||
| 26 | protected $ID_Building = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var int $ID_AccommodationType |
||
| 30 | */ |
||
| 31 | protected $ID_AccommodationType = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string $RoomNo |
||
| 35 | */ |
||
| 36 | protected $RoomNo = null; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var string $Address1 |
||
| 40 | */ |
||
| 41 | protected $Address1 = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var string $LastName |
||
| 45 | */ |
||
| 46 | protected $LastName = null; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var string $FirstName |
||
| 50 | */ |
||
| 51 | protected $FirstName = null; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var string $City |
||
| 55 | */ |
||
| 56 | protected $City = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var string $State |
||
| 60 | */ |
||
| 61 | protected $State = null; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var string $Title |
||
| 65 | */ |
||
| 66 | protected $Title = null; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var string $Country |
||
| 70 | */ |
||
| 71 | protected $Country = null; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var string $ZipCode |
||
| 75 | */ |
||
| 76 | protected $ZipCode = null; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var string $Address2 |
||
| 80 | */ |
||
| 81 | protected $Address2 = null; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var string $WebSiteURL |
||
| 85 | */ |
||
| 86 | protected $WebSiteURL = null; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var string $Email |
||
| 90 | */ |
||
| 91 | protected $Email = null; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var string $ConfirmBy |
||
| 95 | */ |
||
| 96 | protected $ConfirmBy = null; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var boolean $IsMailing |
||
| 100 | */ |
||
| 101 | protected $IsMailing = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var string $ContactType |
||
| 105 | */ |
||
| 106 | protected $ContactType = null; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var string $OtherCieName |
||
| 110 | */ |
||
| 111 | protected $OtherCieName = null; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @var string $BillingType |
||
| 115 | */ |
||
| 116 | protected $BillingType = null; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @var boolean $IsSoldByRoomNo |
||
| 120 | */ |
||
| 121 | protected $IsSoldByRoomNo = null; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @var boolean $IsVirtual |
||
| 125 | */ |
||
| 126 | protected $IsVirtual = null; |
||
| 127 | |||
| 128 | /** |
||
| 129 | * @var float $RankingByRevenue |
||
| 130 | */ |
||
| 131 | protected $RankingByRevenue = null; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @var float $AssignPriority |
||
| 135 | */ |
||
| 136 | protected $AssignPriority = null; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @var float $Grading |
||
| 140 | */ |
||
| 141 | protected $Grading = null; |
||
| 142 | |||
| 143 | /** |
||
| 144 | * @var string $OldRoomNo |
||
| 145 | */ |
||
| 146 | protected $OldRoomNo = null; |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @var string $OptionalRoomName |
||
| 150 | */ |
||
| 151 | protected $OptionalRoomName = null; |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @var string $HousekeepingRoomStatus |
||
| 155 | */ |
||
| 156 | protected $HousekeepingRoomStatus = null; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @var boolean $HousekeepingIsClosed |
||
| 160 | */ |
||
| 161 | protected $HousekeepingIsClosed = null; |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @var boolean $IsSuite |
||
| 165 | */ |
||
| 166 | protected $IsSuite = null; |
||
| 167 | |||
| 168 | /** |
||
| 169 | * @param int $ID_Room |
||
| 170 | * @param int $ID_RoomType |
||
| 171 | * @param int $ID_RoomTypeSuite |
||
| 172 | * @param int $ID_Building |
||
| 173 | * @param int $ID_AccommodationType |
||
| 174 | * @param boolean $IsMailing |
||
| 175 | * @param boolean $IsSoldByRoomNo |
||
| 176 | * @param boolean $IsVirtual |
||
| 177 | * @param float $RankingByRevenue |
||
| 178 | * @param float $AssignPriority |
||
| 179 | * @param float $Grading |
||
| 180 | * @param boolean $HousekeepingIsClosed |
||
| 181 | * @param boolean $IsSuite |
||
| 182 | */ |
||
| 183 | public function __construct($ID_Room, $ID_RoomType, $ID_RoomTypeSuite, $ID_Building, $ID_AccommodationType, $IsMailing, $IsSoldByRoomNo, $IsVirtual, $RankingByRevenue, $AssignPriority, $Grading, $HousekeepingIsClosed, $IsSuite) |
||
| 199 | |||
| 200 | /** |
||
| 201 | * @return int |
||
| 202 | */ |
||
| 203 | public function getID_Room() |
||
| 207 | |||
| 208 | /** |
||
| 209 | * @param int $ID_Room |
||
| 210 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 211 | */ |
||
| 212 | public function setID_Room($ID_Room) |
||
| 217 | |||
| 218 | /** |
||
| 219 | * @return int |
||
| 220 | */ |
||
| 221 | public function getID_RoomType() |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @param int $ID_RoomType |
||
| 228 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 229 | */ |
||
| 230 | public function setID_RoomType($ID_RoomType) |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @return int |
||
| 238 | */ |
||
| 239 | public function getID_RoomTypeSuite() |
||
| 243 | |||
| 244 | /** |
||
| 245 | * @param int $ID_RoomTypeSuite |
||
| 246 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 247 | */ |
||
| 248 | public function setID_RoomTypeSuite($ID_RoomTypeSuite) |
||
| 253 | |||
| 254 | /** |
||
| 255 | * @return int |
||
| 256 | */ |
||
| 257 | public function getID_Building() |
||
| 261 | |||
| 262 | /** |
||
| 263 | * @param int $ID_Building |
||
| 264 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 265 | */ |
||
| 266 | public function setID_Building($ID_Building) |
||
| 271 | |||
| 272 | /** |
||
| 273 | * @return int |
||
| 274 | */ |
||
| 275 | public function getID_AccommodationType() |
||
| 279 | |||
| 280 | /** |
||
| 281 | * @param int $ID_AccommodationType |
||
| 282 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 283 | */ |
||
| 284 | public function setID_AccommodationType($ID_AccommodationType) |
||
| 289 | |||
| 290 | /** |
||
| 291 | * @return string |
||
| 292 | */ |
||
| 293 | public function getRoomNo() |
||
| 297 | |||
| 298 | /** |
||
| 299 | * @param string $RoomNo |
||
| 300 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 301 | */ |
||
| 302 | public function setRoomNo($RoomNo) |
||
| 307 | |||
| 308 | /** |
||
| 309 | * @return string |
||
| 310 | */ |
||
| 311 | public function getAddress1() |
||
| 315 | |||
| 316 | /** |
||
| 317 | * @param string $Address1 |
||
| 318 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 319 | */ |
||
| 320 | public function setAddress1($Address1) |
||
| 325 | |||
| 326 | /** |
||
| 327 | * @return string |
||
| 328 | */ |
||
| 329 | public function getLastName() |
||
| 333 | |||
| 334 | /** |
||
| 335 | * @param string $LastName |
||
| 336 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 337 | */ |
||
| 338 | public function setLastName($LastName) |
||
| 343 | |||
| 344 | /** |
||
| 345 | * @return string |
||
| 346 | */ |
||
| 347 | public function getFirstName() |
||
| 351 | |||
| 352 | /** |
||
| 353 | * @param string $FirstName |
||
| 354 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 355 | */ |
||
| 356 | public function setFirstName($FirstName) |
||
| 361 | |||
| 362 | /** |
||
| 363 | * @return string |
||
| 364 | */ |
||
| 365 | public function getCity() |
||
| 369 | |||
| 370 | /** |
||
| 371 | * @param string $City |
||
| 372 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 373 | */ |
||
| 374 | public function setCity($City) |
||
| 379 | |||
| 380 | /** |
||
| 381 | * @return string |
||
| 382 | */ |
||
| 383 | public function getState() |
||
| 387 | |||
| 388 | /** |
||
| 389 | * @param string $State |
||
| 390 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 391 | */ |
||
| 392 | public function setState($State) |
||
| 397 | |||
| 398 | /** |
||
| 399 | * @return string |
||
| 400 | */ |
||
| 401 | public function getTitle() |
||
| 405 | |||
| 406 | /** |
||
| 407 | * @param string $Title |
||
| 408 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 409 | */ |
||
| 410 | public function setTitle($Title) |
||
| 415 | |||
| 416 | /** |
||
| 417 | * @return string |
||
| 418 | */ |
||
| 419 | public function getCountry() |
||
| 423 | |||
| 424 | /** |
||
| 425 | * @param string $Country |
||
| 426 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 427 | */ |
||
| 428 | public function setCountry($Country) |
||
| 433 | |||
| 434 | /** |
||
| 435 | * @return string |
||
| 436 | */ |
||
| 437 | public function getZipCode() |
||
| 441 | |||
| 442 | /** |
||
| 443 | * @param string $ZipCode |
||
| 444 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 445 | */ |
||
| 446 | public function setZipCode($ZipCode) |
||
| 451 | |||
| 452 | /** |
||
| 453 | * @return string |
||
| 454 | */ |
||
| 455 | public function getAddress2() |
||
| 459 | |||
| 460 | /** |
||
| 461 | * @param string $Address2 |
||
| 462 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 463 | */ |
||
| 464 | public function setAddress2($Address2) |
||
| 469 | |||
| 470 | /** |
||
| 471 | * @return string |
||
| 472 | */ |
||
| 473 | public function getWebSiteURL() |
||
| 477 | |||
| 478 | /** |
||
| 479 | * @param string $WebSiteURL |
||
| 480 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 481 | */ |
||
| 482 | public function setWebSiteURL($WebSiteURL) |
||
| 487 | |||
| 488 | /** |
||
| 489 | * @return string |
||
| 490 | */ |
||
| 491 | public function getEmail() |
||
| 495 | |||
| 496 | /** |
||
| 497 | * @param string $Email |
||
| 498 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 499 | */ |
||
| 500 | public function setEmail($Email) |
||
| 505 | |||
| 506 | /** |
||
| 507 | * @return string |
||
| 508 | */ |
||
| 509 | public function getConfirmBy() |
||
| 513 | |||
| 514 | /** |
||
| 515 | * @param string $ConfirmBy |
||
| 516 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 517 | */ |
||
| 518 | public function setConfirmBy($ConfirmBy) |
||
| 523 | |||
| 524 | /** |
||
| 525 | * @return boolean |
||
| 526 | */ |
||
| 527 | public function getIsMailing() |
||
| 531 | |||
| 532 | /** |
||
| 533 | * @param boolean $IsMailing |
||
| 534 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 535 | */ |
||
| 536 | public function setIsMailing($IsMailing) |
||
| 541 | |||
| 542 | /** |
||
| 543 | * @return string |
||
| 544 | */ |
||
| 545 | public function getContactType() |
||
| 549 | |||
| 550 | /** |
||
| 551 | * @param string $ContactType |
||
| 552 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 553 | */ |
||
| 554 | public function setContactType($ContactType) |
||
| 559 | |||
| 560 | /** |
||
| 561 | * @return string |
||
| 562 | */ |
||
| 563 | public function getOtherCieName() |
||
| 567 | |||
| 568 | /** |
||
| 569 | * @param string $OtherCieName |
||
| 570 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 571 | */ |
||
| 572 | public function setOtherCieName($OtherCieName) |
||
| 577 | |||
| 578 | /** |
||
| 579 | * @return string |
||
| 580 | */ |
||
| 581 | public function getBillingType() |
||
| 585 | |||
| 586 | /** |
||
| 587 | * @param string $BillingType |
||
| 588 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 589 | */ |
||
| 590 | public function setBillingType($BillingType) |
||
| 595 | |||
| 596 | /** |
||
| 597 | * @return boolean |
||
| 598 | */ |
||
| 599 | public function getIsSoldByRoomNo() |
||
| 603 | |||
| 604 | /** |
||
| 605 | * @param boolean $IsSoldByRoomNo |
||
| 606 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 607 | */ |
||
| 608 | public function setIsSoldByRoomNo($IsSoldByRoomNo) |
||
| 613 | |||
| 614 | /** |
||
| 615 | * @return boolean |
||
| 616 | */ |
||
| 617 | public function getIsVirtual() |
||
| 621 | |||
| 622 | /** |
||
| 623 | * @param boolean $IsVirtual |
||
| 624 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 625 | */ |
||
| 626 | public function setIsVirtual($IsVirtual) |
||
| 631 | |||
| 632 | /** |
||
| 633 | * @return float |
||
| 634 | */ |
||
| 635 | public function getRankingByRevenue() |
||
| 639 | |||
| 640 | /** |
||
| 641 | * @param float $RankingByRevenue |
||
| 642 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 643 | */ |
||
| 644 | public function setRankingByRevenue($RankingByRevenue) |
||
| 649 | |||
| 650 | /** |
||
| 651 | * @return float |
||
| 652 | */ |
||
| 653 | public function getAssignPriority() |
||
| 657 | |||
| 658 | /** |
||
| 659 | * @param float $AssignPriority |
||
| 660 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 661 | */ |
||
| 662 | public function setAssignPriority($AssignPriority) |
||
| 667 | |||
| 668 | /** |
||
| 669 | * @return float |
||
| 670 | */ |
||
| 671 | public function getGrading() |
||
| 675 | |||
| 676 | /** |
||
| 677 | * @param float $Grading |
||
| 678 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 679 | */ |
||
| 680 | public function setGrading($Grading) |
||
| 685 | |||
| 686 | /** |
||
| 687 | * @return string |
||
| 688 | */ |
||
| 689 | public function getOldRoomNo() |
||
| 693 | |||
| 694 | /** |
||
| 695 | * @param string $OldRoomNo |
||
| 696 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 697 | */ |
||
| 698 | public function setOldRoomNo($OldRoomNo) |
||
| 703 | |||
| 704 | /** |
||
| 705 | * @return string |
||
| 706 | */ |
||
| 707 | public function getOptionalRoomName() |
||
| 711 | |||
| 712 | /** |
||
| 713 | * @param string $OptionalRoomName |
||
| 714 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 715 | */ |
||
| 716 | public function setOptionalRoomName($OptionalRoomName) |
||
| 721 | |||
| 722 | /** |
||
| 723 | * @return string |
||
| 724 | */ |
||
| 725 | public function getHousekeepingRoomStatus() |
||
| 729 | |||
| 730 | /** |
||
| 731 | * @param string $HousekeepingRoomStatus |
||
| 732 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 733 | */ |
||
| 734 | public function setHousekeepingRoomStatus($HousekeepingRoomStatus) |
||
| 739 | |||
| 740 | /** |
||
| 741 | * @return boolean |
||
| 742 | */ |
||
| 743 | public function getHousekeepingIsClosed() |
||
| 747 | |||
| 748 | /** |
||
| 749 | * @param boolean $HousekeepingIsClosed |
||
| 750 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 751 | */ |
||
| 752 | public function setHousekeepingIsClosed($HousekeepingIsClosed) |
||
| 757 | |||
| 758 | /** |
||
| 759 | * @return boolean |
||
| 760 | */ |
||
| 761 | public function getIsSuite() |
||
| 765 | |||
| 766 | /** |
||
| 767 | * @param boolean $IsSuite |
||
| 768 | * @return \Gueststream\PMS\IQWare\API\RoomAvailabilityForStay |
||
| 769 | */ |
||
| 770 | public function setIsSuite($IsSuite) |
||
| 775 | } |
||
| 776 |