Complex classes like StayValue3 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 StayValue3, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 5 | class StayValue3 |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var int $ID_Stay |
||
| 10 | */ |
||
| 11 | protected $ID_Stay = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var int $ID_RoomType |
||
| 15 | */ |
||
| 16 | protected $ID_RoomType = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var int $ID_RateCode |
||
| 20 | */ |
||
| 21 | protected $ID_RateCode = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var boolean $Evaluated |
||
| 25 | */ |
||
| 26 | protected $Evaluated = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var float $TotalStay |
||
| 30 | */ |
||
| 31 | protected $TotalStay = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var float $TotalRate |
||
| 35 | */ |
||
| 36 | protected $TotalRate = null; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var float $TotalOthers |
||
| 40 | */ |
||
| 41 | protected $TotalOthers = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var float $TotalBase |
||
| 45 | */ |
||
| 46 | protected $TotalBase = null; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var float $TotalTaxes |
||
| 50 | */ |
||
| 51 | protected $TotalTaxes = null; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var float $TotalRateSpecial |
||
| 55 | */ |
||
| 56 | protected $TotalRateSpecial = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var float $TotalYeildReference |
||
| 60 | */ |
||
| 61 | protected $TotalYeildReference = null; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var float $ResortFeeBeforeTaxes |
||
| 65 | */ |
||
| 66 | protected $ResortFeeBeforeTaxes = null; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var boolean $Yielded |
||
| 70 | */ |
||
| 71 | protected $Yielded = null; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var boolean $IsOnArrival |
||
| 75 | */ |
||
| 76 | protected $IsOnArrival = null; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var boolean $IsOnDeparture |
||
| 80 | */ |
||
| 81 | protected $IsOnDeparture = null; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var boolean $IsFixedLength |
||
| 85 | */ |
||
| 86 | protected $IsFixedLength = null; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var int $MinimumNights |
||
| 90 | */ |
||
| 91 | protected $MinimumNights = null; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var \DateTime $YieldDate |
||
| 95 | */ |
||
| 96 | protected $YieldDate = null; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var ArrayOfStayByNightValue $StayDailyValuesArray |
||
| 100 | */ |
||
| 101 | protected $StayDailyValuesArray = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var ArrayOfSBDSummary $SingleStayValue |
||
| 105 | */ |
||
| 106 | protected $SingleStayValue = null; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var ArrayOfAvailableSuite $AvailableSuites |
||
| 110 | */ |
||
| 111 | protected $AvailableSuites = null; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @var ArrayOfAvailableRoom $AvailableRooms |
||
| 115 | */ |
||
| 116 | protected $AvailableRooms = null; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @var ArrayOfSpecialData $SpecialDatas |
||
| 120 | */ |
||
| 121 | protected $SpecialDatas = null; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @param int $ID_Stay |
||
| 125 | * @param int $ID_RoomType |
||
| 126 | * @param int $ID_RateCode |
||
| 127 | * @param boolean $Evaluated |
||
| 128 | * @param float $TotalStay |
||
| 129 | * @param float $TotalRate |
||
| 130 | * @param float $TotalOthers |
||
| 131 | * @param float $TotalBase |
||
| 132 | * @param float $TotalTaxes |
||
| 133 | * @param float $TotalRateSpecial |
||
| 134 | * @param float $TotalYeildReference |
||
| 135 | * @param float $ResortFeeBeforeTaxes |
||
| 136 | * @param boolean $Yielded |
||
| 137 | * @param boolean $IsOnArrival |
||
| 138 | * @param boolean $IsOnDeparture |
||
| 139 | * @param boolean $IsFixedLength |
||
| 140 | * @param int $MinimumNights |
||
| 141 | * @param \DateTime $YieldDate |
||
| 142 | */ |
||
| 143 | public function __construct($ID_Stay, $ID_RoomType, $ID_RateCode, $Evaluated, $TotalStay, $TotalRate, $TotalOthers, $TotalBase, $TotalTaxes, $TotalRateSpecial, $TotalYeildReference, $ResortFeeBeforeTaxes, $Yielded, $IsOnArrival, $IsOnDeparture, $IsFixedLength, $MinimumNights, \DateTime $YieldDate) |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @return int |
||
| 167 | */ |
||
| 168 | public function getID_Stay() |
||
| 172 | |||
| 173 | /** |
||
| 174 | * @param int $ID_Stay |
||
| 175 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 176 | */ |
||
| 177 | public function setID_Stay($ID_Stay) |
||
| 182 | |||
| 183 | /** |
||
| 184 | * @return int |
||
| 185 | */ |
||
| 186 | public function getID_RoomType() |
||
| 190 | |||
| 191 | /** |
||
| 192 | * @param int $ID_RoomType |
||
| 193 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 194 | */ |
||
| 195 | public function setID_RoomType($ID_RoomType) |
||
| 200 | |||
| 201 | /** |
||
| 202 | * @return int |
||
| 203 | */ |
||
| 204 | public function getID_RateCode() |
||
| 208 | |||
| 209 | /** |
||
| 210 | * @param int $ID_RateCode |
||
| 211 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 212 | */ |
||
| 213 | public function setID_RateCode($ID_RateCode) |
||
| 218 | |||
| 219 | /** |
||
| 220 | * @return boolean |
||
| 221 | */ |
||
| 222 | public function getEvaluated() |
||
| 226 | |||
| 227 | /** |
||
| 228 | * @param boolean $Evaluated |
||
| 229 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 230 | */ |
||
| 231 | public function setEvaluated($Evaluated) |
||
| 236 | |||
| 237 | /** |
||
| 238 | * @return float |
||
| 239 | */ |
||
| 240 | public function getTotalStay() |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @param float $TotalStay |
||
| 247 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 248 | */ |
||
| 249 | public function setTotalStay($TotalStay) |
||
| 254 | |||
| 255 | /** |
||
| 256 | * @return float |
||
| 257 | */ |
||
| 258 | public function getTotalRate() |
||
| 262 | |||
| 263 | /** |
||
| 264 | * @param float $TotalRate |
||
| 265 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 266 | */ |
||
| 267 | public function setTotalRate($TotalRate) |
||
| 272 | |||
| 273 | /** |
||
| 274 | * @return float |
||
| 275 | */ |
||
| 276 | public function getTotalOthers() |
||
| 280 | |||
| 281 | /** |
||
| 282 | * @param float $TotalOthers |
||
| 283 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 284 | */ |
||
| 285 | public function setTotalOthers($TotalOthers) |
||
| 290 | |||
| 291 | /** |
||
| 292 | * @return float |
||
| 293 | */ |
||
| 294 | public function getTotalBase() |
||
| 298 | |||
| 299 | /** |
||
| 300 | * @param float $TotalBase |
||
| 301 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 302 | */ |
||
| 303 | public function setTotalBase($TotalBase) |
||
| 308 | |||
| 309 | /** |
||
| 310 | * @return float |
||
| 311 | */ |
||
| 312 | public function getTotalTaxes() |
||
| 316 | |||
| 317 | /** |
||
| 318 | * @param float $TotalTaxes |
||
| 319 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 320 | */ |
||
| 321 | public function setTotalTaxes($TotalTaxes) |
||
| 326 | |||
| 327 | /** |
||
| 328 | * @return float |
||
| 329 | */ |
||
| 330 | public function getTotalRateSpecial() |
||
| 334 | |||
| 335 | /** |
||
| 336 | * @param float $TotalRateSpecial |
||
| 337 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 338 | */ |
||
| 339 | public function setTotalRateSpecial($TotalRateSpecial) |
||
| 344 | |||
| 345 | /** |
||
| 346 | * @return float |
||
| 347 | */ |
||
| 348 | public function getTotalYeildReference() |
||
| 352 | |||
| 353 | /** |
||
| 354 | * @param float $TotalYeildReference |
||
| 355 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 356 | */ |
||
| 357 | public function setTotalYeildReference($TotalYeildReference) |
||
| 362 | |||
| 363 | /** |
||
| 364 | * @return float |
||
| 365 | */ |
||
| 366 | public function getResortFeeBeforeTaxes() |
||
| 370 | |||
| 371 | /** |
||
| 372 | * @param float $ResortFeeBeforeTaxes |
||
| 373 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 374 | */ |
||
| 375 | public function setResortFeeBeforeTaxes($ResortFeeBeforeTaxes) |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @return boolean |
||
| 383 | */ |
||
| 384 | public function getYielded() |
||
| 388 | |||
| 389 | /** |
||
| 390 | * @param boolean $Yielded |
||
| 391 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 392 | */ |
||
| 393 | public function setYielded($Yielded) |
||
| 398 | |||
| 399 | /** |
||
| 400 | * @return boolean |
||
| 401 | */ |
||
| 402 | public function getIsOnArrival() |
||
| 406 | |||
| 407 | /** |
||
| 408 | * @param boolean $IsOnArrival |
||
| 409 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 410 | */ |
||
| 411 | public function setIsOnArrival($IsOnArrival) |
||
| 416 | |||
| 417 | /** |
||
| 418 | * @return boolean |
||
| 419 | */ |
||
| 420 | public function getIsOnDeparture() |
||
| 424 | |||
| 425 | /** |
||
| 426 | * @param boolean $IsOnDeparture |
||
| 427 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 428 | */ |
||
| 429 | public function setIsOnDeparture($IsOnDeparture) |
||
| 434 | |||
| 435 | /** |
||
| 436 | * @return boolean |
||
| 437 | */ |
||
| 438 | public function getIsFixedLength() |
||
| 442 | |||
| 443 | /** |
||
| 444 | * @param boolean $IsFixedLength |
||
| 445 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 446 | */ |
||
| 447 | public function setIsFixedLength($IsFixedLength) |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return int |
||
| 455 | */ |
||
| 456 | public function getMinimumNights() |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @param int $MinimumNights |
||
| 463 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 464 | */ |
||
| 465 | public function setMinimumNights($MinimumNights) |
||
| 470 | |||
| 471 | /** |
||
| 472 | * @return \DateTime |
||
| 473 | */ |
||
| 474 | public function getYieldDate() |
||
| 486 | |||
| 487 | /** |
||
| 488 | * @param \DateTime $YieldDate |
||
| 489 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 490 | */ |
||
| 491 | public function setYieldDate(\DateTime $YieldDate) |
||
| 496 | |||
| 497 | /** |
||
| 498 | * @return ArrayOfStayByNightValue |
||
| 499 | */ |
||
| 500 | public function getStayDailyValuesArray() |
||
| 504 | |||
| 505 | /** |
||
| 506 | * @param ArrayOfStayByNightValue $StayDailyValuesArray |
||
| 507 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 508 | */ |
||
| 509 | public function setStayDailyValuesArray($StayDailyValuesArray) |
||
| 514 | |||
| 515 | /** |
||
| 516 | * @return ArrayOfSBDSummary |
||
| 517 | */ |
||
| 518 | public function getSingleStayValue() |
||
| 522 | |||
| 523 | /** |
||
| 524 | * @param ArrayOfSBDSummary $SingleStayValue |
||
| 525 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 526 | */ |
||
| 527 | public function setSingleStayValue($SingleStayValue) |
||
| 532 | |||
| 533 | /** |
||
| 534 | * @return ArrayOfAvailableSuite |
||
| 535 | */ |
||
| 536 | public function getAvailableSuites() |
||
| 540 | |||
| 541 | /** |
||
| 542 | * @param ArrayOfAvailableSuite $AvailableSuites |
||
| 543 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 544 | */ |
||
| 545 | public function setAvailableSuites($AvailableSuites) |
||
| 550 | |||
| 551 | /** |
||
| 552 | * @return ArrayOfAvailableRoom |
||
| 553 | */ |
||
| 554 | public function getAvailableRooms() |
||
| 558 | |||
| 559 | /** |
||
| 560 | * @param ArrayOfAvailableRoom $AvailableRooms |
||
| 561 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 562 | */ |
||
| 563 | public function setAvailableRooms($AvailableRooms) |
||
| 568 | |||
| 569 | /** |
||
| 570 | * @return ArrayOfSpecialData |
||
| 571 | */ |
||
| 572 | public function getSpecialDatas() |
||
| 576 | |||
| 577 | /** |
||
| 578 | * @param ArrayOfSpecialData $SpecialDatas |
||
| 579 | * @return \Gueststream\PMS\IQWare\API\StayValue3 |
||
| 580 | */ |
||
| 581 | public function setSpecialDatas($SpecialDatas) |
||
| 586 | } |
||
| 587 |
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..