Complex classes like InfosBilling 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 InfosBilling, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 5 | class InfosBilling |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var int $ConfirmationNo |
||
| 10 | */ |
||
| 11 | protected $ConfirmationNo = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var float $RevRoomChargesTotal |
||
| 15 | */ |
||
| 16 | protected $RevRoomChargesTotal = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var float $RevRoomChargesTaxes |
||
| 20 | */ |
||
| 21 | protected $RevRoomChargesTaxes = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var float $RevElementTotal |
||
| 25 | */ |
||
| 26 | protected $RevElementTotal = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var float $RevElementTaxes |
||
| 30 | */ |
||
| 31 | protected $RevElementTaxes = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var float $RevAttributeTotal |
||
| 35 | */ |
||
| 36 | protected $RevAttributeTotal = null; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var float $RevAttributeTaxes |
||
| 40 | */ |
||
| 41 | protected $RevAttributeTaxes = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var float $RevLocationTotal |
||
| 45 | */ |
||
| 46 | protected $RevLocationTotal = null; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var float $RevLocationTaxes |
||
| 50 | */ |
||
| 51 | protected $RevLocationTaxes = null; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var float $RevSvcChargeTotal |
||
| 55 | */ |
||
| 56 | protected $RevSvcChargeTotal = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var float $RevSvcChargeTaxes |
||
| 60 | */ |
||
| 61 | protected $RevSvcChargeTaxes = null; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var float $RevElementALaCarteTotal |
||
| 65 | */ |
||
| 66 | protected $RevElementALaCarteTotal = null; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var float $RevElementALaCarteTaxes |
||
| 70 | */ |
||
| 71 | protected $RevElementALaCarteTaxes = null; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var float $RevPromotionTotal |
||
| 75 | */ |
||
| 76 | protected $RevPromotionTotal = null; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var float $RevPromotionTaxes |
||
| 80 | */ |
||
| 81 | protected $RevPromotionTaxes = null; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var string $RateCode |
||
| 85 | */ |
||
| 86 | protected $RateCode = null; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var \DateTime $ArrivalDate |
||
| 90 | */ |
||
| 91 | protected $ArrivalDate = null; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var \DateTime $DepartureDate |
||
| 95 | */ |
||
| 96 | protected $DepartureDate = null; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var int $Adults |
||
| 100 | */ |
||
| 101 | protected $Adults = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var int $Children |
||
| 105 | */ |
||
| 106 | protected $Children = null; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var string $RoomTypeSold |
||
| 110 | */ |
||
| 111 | protected $RoomTypeSold = null; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @var string $RoomTypeOccupied |
||
| 115 | */ |
||
| 116 | protected $RoomTypeOccupied = null; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @var string $FirstName |
||
| 120 | */ |
||
| 121 | protected $FirstName = null; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @var string $LastName |
||
| 125 | */ |
||
| 126 | protected $LastName = null; |
||
| 127 | |||
| 128 | /** |
||
| 129 | * @var string $Address1 |
||
| 130 | */ |
||
| 131 | protected $Address1 = null; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @var string $Address2 |
||
| 135 | */ |
||
| 136 | protected $Address2 = null; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @var string $City |
||
| 140 | */ |
||
| 141 | protected $City = null; |
||
| 142 | |||
| 143 | /** |
||
| 144 | * @var string $State |
||
| 145 | */ |
||
| 146 | protected $State = null; |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @var string $ZipCode |
||
| 150 | */ |
||
| 151 | protected $ZipCode = null; |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @var string $Country |
||
| 155 | */ |
||
| 156 | protected $Country = null; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @var string $Email |
||
| 160 | */ |
||
| 161 | protected $Email = null; |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @var string $HomePhone |
||
| 165 | */ |
||
| 166 | protected $HomePhone = null; |
||
| 167 | |||
| 168 | /** |
||
| 169 | * @var \DateTime $BookingDate |
||
| 170 | */ |
||
| 171 | protected $BookingDate = null; |
||
| 172 | |||
| 173 | /** |
||
| 174 | * @param int $ConfirmationNo |
||
| 175 | * @param float $RevRoomChargesTotal |
||
| 176 | * @param float $RevRoomChargesTaxes |
||
| 177 | * @param float $RevElementTotal |
||
| 178 | * @param float $RevElementTaxes |
||
| 179 | * @param float $RevAttributeTotal |
||
| 180 | * @param float $RevAttributeTaxes |
||
| 181 | * @param float $RevLocationTotal |
||
| 182 | * @param float $RevLocationTaxes |
||
| 183 | * @param float $RevSvcChargeTotal |
||
| 184 | * @param float $RevSvcChargeTaxes |
||
| 185 | * @param float $RevElementALaCarteTotal |
||
| 186 | * @param float $RevElementALaCarteTaxes |
||
| 187 | * @param float $RevPromotionTotal |
||
| 188 | * @param float $RevPromotionTaxes |
||
| 189 | * @param \DateTime $ArrivalDate |
||
| 190 | * @param \DateTime $DepartureDate |
||
| 191 | * @param int $Adults |
||
| 192 | * @param int $Children |
||
| 193 | * @param \DateTime $BookingDate |
||
| 194 | */ |
||
| 195 | public function __construct($ConfirmationNo, $RevRoomChargesTotal, $RevRoomChargesTaxes, $RevElementTotal, $RevElementTaxes, $RevAttributeTotal, $RevAttributeTaxes, $RevLocationTotal, $RevLocationTaxes, $RevSvcChargeTotal, $RevSvcChargeTaxes, $RevElementALaCarteTotal, $RevElementALaCarteTaxes, $RevPromotionTotal, $RevPromotionTaxes, \DateTime $ArrivalDate, \DateTime $DepartureDate, $Adults, $Children, \DateTime $BookingDate) |
||
| 218 | |||
| 219 | /** |
||
| 220 | * @return int |
||
| 221 | */ |
||
| 222 | public function getConfirmationNo() |
||
| 226 | |||
| 227 | /** |
||
| 228 | * @param int $ConfirmationNo |
||
| 229 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 230 | */ |
||
| 231 | public function setConfirmationNo($ConfirmationNo) |
||
| 236 | |||
| 237 | /** |
||
| 238 | * @return float |
||
| 239 | */ |
||
| 240 | public function getRevRoomChargesTotal() |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @param float $RevRoomChargesTotal |
||
| 247 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 248 | */ |
||
| 249 | public function setRevRoomChargesTotal($RevRoomChargesTotal) |
||
| 254 | |||
| 255 | /** |
||
| 256 | * @return float |
||
| 257 | */ |
||
| 258 | public function getRevRoomChargesTaxes() |
||
| 262 | |||
| 263 | /** |
||
| 264 | * @param float $RevRoomChargesTaxes |
||
| 265 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 266 | */ |
||
| 267 | public function setRevRoomChargesTaxes($RevRoomChargesTaxes) |
||
| 272 | |||
| 273 | /** |
||
| 274 | * @return float |
||
| 275 | */ |
||
| 276 | public function getRevElementTotal() |
||
| 280 | |||
| 281 | /** |
||
| 282 | * @param float $RevElementTotal |
||
| 283 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 284 | */ |
||
| 285 | public function setRevElementTotal($RevElementTotal) |
||
| 290 | |||
| 291 | /** |
||
| 292 | * @return float |
||
| 293 | */ |
||
| 294 | public function getRevElementTaxes() |
||
| 298 | |||
| 299 | /** |
||
| 300 | * @param float $RevElementTaxes |
||
| 301 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 302 | */ |
||
| 303 | public function setRevElementTaxes($RevElementTaxes) |
||
| 308 | |||
| 309 | /** |
||
| 310 | * @return float |
||
| 311 | */ |
||
| 312 | public function getRevAttributeTotal() |
||
| 316 | |||
| 317 | /** |
||
| 318 | * @param float $RevAttributeTotal |
||
| 319 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 320 | */ |
||
| 321 | public function setRevAttributeTotal($RevAttributeTotal) |
||
| 326 | |||
| 327 | /** |
||
| 328 | * @return float |
||
| 329 | */ |
||
| 330 | public function getRevAttributeTaxes() |
||
| 334 | |||
| 335 | /** |
||
| 336 | * @param float $RevAttributeTaxes |
||
| 337 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 338 | */ |
||
| 339 | public function setRevAttributeTaxes($RevAttributeTaxes) |
||
| 344 | |||
| 345 | /** |
||
| 346 | * @return float |
||
| 347 | */ |
||
| 348 | public function getRevLocationTotal() |
||
| 352 | |||
| 353 | /** |
||
| 354 | * @param float $RevLocationTotal |
||
| 355 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 356 | */ |
||
| 357 | public function setRevLocationTotal($RevLocationTotal) |
||
| 362 | |||
| 363 | /** |
||
| 364 | * @return float |
||
| 365 | */ |
||
| 366 | public function getRevLocationTaxes() |
||
| 370 | |||
| 371 | /** |
||
| 372 | * @param float $RevLocationTaxes |
||
| 373 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 374 | */ |
||
| 375 | public function setRevLocationTaxes($RevLocationTaxes) |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @return float |
||
| 383 | */ |
||
| 384 | public function getRevSvcChargeTotal() |
||
| 388 | |||
| 389 | /** |
||
| 390 | * @param float $RevSvcChargeTotal |
||
| 391 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 392 | */ |
||
| 393 | public function setRevSvcChargeTotal($RevSvcChargeTotal) |
||
| 398 | |||
| 399 | /** |
||
| 400 | * @return float |
||
| 401 | */ |
||
| 402 | public function getRevSvcChargeTaxes() |
||
| 406 | |||
| 407 | /** |
||
| 408 | * @param float $RevSvcChargeTaxes |
||
| 409 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 410 | */ |
||
| 411 | public function setRevSvcChargeTaxes($RevSvcChargeTaxes) |
||
| 416 | |||
| 417 | /** |
||
| 418 | * @return float |
||
| 419 | */ |
||
| 420 | public function getRevElementALaCarteTotal() |
||
| 424 | |||
| 425 | /** |
||
| 426 | * @param float $RevElementALaCarteTotal |
||
| 427 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 428 | */ |
||
| 429 | public function setRevElementALaCarteTotal($RevElementALaCarteTotal) |
||
| 434 | |||
| 435 | /** |
||
| 436 | * @return float |
||
| 437 | */ |
||
| 438 | public function getRevElementALaCarteTaxes() |
||
| 442 | |||
| 443 | /** |
||
| 444 | * @param float $RevElementALaCarteTaxes |
||
| 445 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 446 | */ |
||
| 447 | public function setRevElementALaCarteTaxes($RevElementALaCarteTaxes) |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return float |
||
| 455 | */ |
||
| 456 | public function getRevPromotionTotal() |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @param float $RevPromotionTotal |
||
| 463 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 464 | */ |
||
| 465 | public function setRevPromotionTotal($RevPromotionTotal) |
||
| 470 | |||
| 471 | /** |
||
| 472 | * @return float |
||
| 473 | */ |
||
| 474 | public function getRevPromotionTaxes() |
||
| 478 | |||
| 479 | /** |
||
| 480 | * @param float $RevPromotionTaxes |
||
| 481 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 482 | */ |
||
| 483 | public function setRevPromotionTaxes($RevPromotionTaxes) |
||
| 488 | |||
| 489 | /** |
||
| 490 | * @return string |
||
| 491 | */ |
||
| 492 | public function getRateCode() |
||
| 496 | |||
| 497 | /** |
||
| 498 | * @param string $RateCode |
||
| 499 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 500 | */ |
||
| 501 | public function setRateCode($RateCode) |
||
| 506 | |||
| 507 | /** |
||
| 508 | * @return \DateTime |
||
| 509 | */ |
||
| 510 | public function getArrivalDate() |
||
| 522 | |||
| 523 | /** |
||
| 524 | * @param \DateTime $ArrivalDate |
||
| 525 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 526 | */ |
||
| 527 | public function setArrivalDate(\DateTime $ArrivalDate) |
||
| 532 | |||
| 533 | /** |
||
| 534 | * @return \DateTime |
||
| 535 | */ |
||
| 536 | public function getDepartureDate() |
||
| 548 | |||
| 549 | /** |
||
| 550 | * @param \DateTime $DepartureDate |
||
| 551 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 552 | */ |
||
| 553 | public function setDepartureDate(\DateTime $DepartureDate) |
||
| 558 | |||
| 559 | /** |
||
| 560 | * @return int |
||
| 561 | */ |
||
| 562 | public function getAdults() |
||
| 566 | |||
| 567 | /** |
||
| 568 | * @param int $Adults |
||
| 569 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 570 | */ |
||
| 571 | public function setAdults($Adults) |
||
| 576 | |||
| 577 | /** |
||
| 578 | * @return int |
||
| 579 | */ |
||
| 580 | public function getChildren() |
||
| 584 | |||
| 585 | /** |
||
| 586 | * @param int $Children |
||
| 587 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 588 | */ |
||
| 589 | public function setChildren($Children) |
||
| 594 | |||
| 595 | /** |
||
| 596 | * @return string |
||
| 597 | */ |
||
| 598 | public function getRoomTypeSold() |
||
| 602 | |||
| 603 | /** |
||
| 604 | * @param string $RoomTypeSold |
||
| 605 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 606 | */ |
||
| 607 | public function setRoomTypeSold($RoomTypeSold) |
||
| 612 | |||
| 613 | /** |
||
| 614 | * @return string |
||
| 615 | */ |
||
| 616 | public function getRoomTypeOccupied() |
||
| 620 | |||
| 621 | /** |
||
| 622 | * @param string $RoomTypeOccupied |
||
| 623 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 624 | */ |
||
| 625 | public function setRoomTypeOccupied($RoomTypeOccupied) |
||
| 630 | |||
| 631 | /** |
||
| 632 | * @return string |
||
| 633 | */ |
||
| 634 | public function getFirstName() |
||
| 638 | |||
| 639 | /** |
||
| 640 | * @param string $FirstName |
||
| 641 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 642 | */ |
||
| 643 | public function setFirstName($FirstName) |
||
| 648 | |||
| 649 | /** |
||
| 650 | * @return string |
||
| 651 | */ |
||
| 652 | public function getLastName() |
||
| 656 | |||
| 657 | /** |
||
| 658 | * @param string $LastName |
||
| 659 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 660 | */ |
||
| 661 | public function setLastName($LastName) |
||
| 666 | |||
| 667 | /** |
||
| 668 | * @return string |
||
| 669 | */ |
||
| 670 | public function getAddress1() |
||
| 674 | |||
| 675 | /** |
||
| 676 | * @param string $Address1 |
||
| 677 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 678 | */ |
||
| 679 | public function setAddress1($Address1) |
||
| 684 | |||
| 685 | /** |
||
| 686 | * @return string |
||
| 687 | */ |
||
| 688 | public function getAddress2() |
||
| 692 | |||
| 693 | /** |
||
| 694 | * @param string $Address2 |
||
| 695 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 696 | */ |
||
| 697 | public function setAddress2($Address2) |
||
| 702 | |||
| 703 | /** |
||
| 704 | * @return string |
||
| 705 | */ |
||
| 706 | public function getCity() |
||
| 710 | |||
| 711 | /** |
||
| 712 | * @param string $City |
||
| 713 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 714 | */ |
||
| 715 | public function setCity($City) |
||
| 720 | |||
| 721 | /** |
||
| 722 | * @return string |
||
| 723 | */ |
||
| 724 | public function getState() |
||
| 728 | |||
| 729 | /** |
||
| 730 | * @param string $State |
||
| 731 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 732 | */ |
||
| 733 | public function setState($State) |
||
| 738 | |||
| 739 | /** |
||
| 740 | * @return string |
||
| 741 | */ |
||
| 742 | public function getZipCode() |
||
| 746 | |||
| 747 | /** |
||
| 748 | * @param string $ZipCode |
||
| 749 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 750 | */ |
||
| 751 | public function setZipCode($ZipCode) |
||
| 756 | |||
| 757 | /** |
||
| 758 | * @return string |
||
| 759 | */ |
||
| 760 | public function getCountry() |
||
| 764 | |||
| 765 | /** |
||
| 766 | * @param string $Country |
||
| 767 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 768 | */ |
||
| 769 | public function setCountry($Country) |
||
| 774 | |||
| 775 | /** |
||
| 776 | * @return string |
||
| 777 | */ |
||
| 778 | public function getEmail() |
||
| 782 | |||
| 783 | /** |
||
| 784 | * @param string $Email |
||
| 785 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 786 | */ |
||
| 787 | public function setEmail($Email) |
||
| 792 | |||
| 793 | /** |
||
| 794 | * @return string |
||
| 795 | */ |
||
| 796 | public function getHomePhone() |
||
| 800 | |||
| 801 | /** |
||
| 802 | * @param string $HomePhone |
||
| 803 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 804 | */ |
||
| 805 | public function setHomePhone($HomePhone) |
||
| 810 | |||
| 811 | /** |
||
| 812 | * @return \DateTime |
||
| 813 | */ |
||
| 814 | public function getBookingDate() |
||
| 826 | |||
| 827 | /** |
||
| 828 | * @param \DateTime $BookingDate |
||
| 829 | * @return \Gueststream\PMS\IQWare\API\InfosBilling |
||
| 830 | */ |
||
| 831 | public function setBookingDate(\DateTime $BookingDate) |
||
| 836 | } |
||
| 837 |
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..