Complex classes like DailyActivityAR 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 DailyActivityAR, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
5 | class DailyActivityAR |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var int $ID_Account |
||
10 | */ |
||
11 | protected $ID_Account = null; |
||
12 | |||
13 | /** |
||
14 | * @var int $AccountNo |
||
15 | */ |
||
16 | protected $AccountNo = null; |
||
17 | |||
18 | /** |
||
19 | * @var int $OOE |
||
20 | */ |
||
21 | protected $OOE = null; |
||
22 | |||
23 | /** |
||
24 | * @var int $OOR |
||
25 | */ |
||
26 | protected $OOR = null; |
||
27 | |||
28 | /** |
||
29 | * @var int $OOO |
||
30 | */ |
||
31 | protected $OOO = null; |
||
32 | |||
33 | /** |
||
34 | * @var \DateTime $AccountDate |
||
35 | */ |
||
36 | protected $AccountDate = null; |
||
37 | |||
38 | /** |
||
39 | * @var float $TotRoomRev |
||
40 | */ |
||
41 | protected $TotRoomRev = null; |
||
42 | |||
43 | /** |
||
44 | * @var float $TotComm |
||
45 | */ |
||
46 | protected $TotComm = null; |
||
47 | |||
48 | /** |
||
49 | * @var float $TotTax1 |
||
50 | */ |
||
51 | protected $TotTax1 = null; |
||
52 | |||
53 | /** |
||
54 | * @var float $TotTax2 |
||
55 | */ |
||
56 | protected $TotTax2 = null; |
||
57 | |||
58 | /** |
||
59 | * @var float $TotTax3 |
||
60 | */ |
||
61 | protected $TotTax3 = null; |
||
62 | |||
63 | /** |
||
64 | * @var float $TotOtherCB |
||
65 | */ |
||
66 | protected $TotOtherCB = null; |
||
67 | |||
68 | /** |
||
69 | * @var float $TotReferal |
||
70 | */ |
||
71 | protected $TotReferal = null; |
||
72 | |||
73 | /** |
||
74 | * @var float $TotCommCC |
||
75 | */ |
||
76 | protected $TotCommCC = null; |
||
77 | |||
78 | /** |
||
79 | * @var float $DailyPct |
||
80 | */ |
||
81 | protected $DailyPct = null; |
||
82 | |||
83 | /** |
||
84 | * @var int $BookingType |
||
85 | */ |
||
86 | protected $BookingType = null; |
||
87 | |||
88 | /** |
||
89 | * @var int $SeqNo |
||
90 | */ |
||
91 | protected $SeqNo = null; |
||
92 | |||
93 | /** |
||
94 | * @var \DateTime $ArrivalDate |
||
95 | */ |
||
96 | protected $ArrivalDate = null; |
||
97 | |||
98 | /** |
||
99 | * @var \DateTime $DepartureDate |
||
100 | */ |
||
101 | protected $DepartureDate = null; |
||
102 | |||
103 | /** |
||
104 | * @var int $ArStatus |
||
105 | */ |
||
106 | protected $ArStatus = null; |
||
107 | |||
108 | /** |
||
109 | * @var \DateTime $DateArStatus |
||
110 | */ |
||
111 | protected $DateArStatus = null; |
||
112 | |||
113 | /** |
||
114 | * @param int $ID_Account |
||
115 | * @param int $AccountNo |
||
116 | * @param int $OOE |
||
117 | * @param int $OOR |
||
118 | * @param int $OOO |
||
119 | * @param \DateTime $AccountDate |
||
120 | * @param float $TotRoomRev |
||
121 | * @param float $TotComm |
||
122 | * @param float $TotTax1 |
||
123 | * @param float $TotTax2 |
||
124 | * @param float $TotTax3 |
||
125 | * @param float $TotOtherCB |
||
126 | * @param float $TotReferal |
||
127 | * @param float $TotCommCC |
||
128 | * @param float $DailyPct |
||
129 | * @param int $BookingType |
||
130 | * @param int $SeqNo |
||
131 | * @param \DateTime $ArrivalDate |
||
132 | * @param \DateTime $DepartureDate |
||
133 | * @param int $ArStatus |
||
134 | * @param \DateTime $DateArStatus |
||
135 | */ |
||
136 | public function __construct($ID_Account, $AccountNo, $OOE, $OOR, $OOO, \DateTime $AccountDate, $TotRoomRev, $TotComm, $TotTax1, $TotTax2, $TotTax3, $TotOtherCB, $TotReferal, $TotCommCC, $DailyPct, $BookingType, $SeqNo, \DateTime $ArrivalDate, \DateTime $DepartureDate, $ArStatus, \DateTime $DateArStatus) |
||
160 | |||
161 | /** |
||
162 | * @return int |
||
163 | */ |
||
164 | public function getID_Account() |
||
168 | |||
169 | /** |
||
170 | * @param int $ID_Account |
||
171 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
172 | */ |
||
173 | public function setID_Account($ID_Account) |
||
178 | |||
179 | /** |
||
180 | * @return int |
||
181 | */ |
||
182 | public function getAccountNo() |
||
186 | |||
187 | /** |
||
188 | * @param int $AccountNo |
||
189 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
190 | */ |
||
191 | public function setAccountNo($AccountNo) |
||
196 | |||
197 | /** |
||
198 | * @return int |
||
199 | */ |
||
200 | public function getOOE() |
||
204 | |||
205 | /** |
||
206 | * @param int $OOE |
||
207 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
208 | */ |
||
209 | public function setOOE($OOE) |
||
214 | |||
215 | /** |
||
216 | * @return int |
||
217 | */ |
||
218 | public function getOOR() |
||
222 | |||
223 | /** |
||
224 | * @param int $OOR |
||
225 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
226 | */ |
||
227 | public function setOOR($OOR) |
||
232 | |||
233 | /** |
||
234 | * @return int |
||
235 | */ |
||
236 | public function getOOO() |
||
240 | |||
241 | /** |
||
242 | * @param int $OOO |
||
243 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
244 | */ |
||
245 | public function setOOO($OOO) |
||
250 | |||
251 | /** |
||
252 | * @return \DateTime |
||
253 | */ |
||
254 | public function getAccountDate() |
||
266 | |||
267 | /** |
||
268 | * @param \DateTime $AccountDate |
||
269 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
270 | */ |
||
271 | public function setAccountDate(\DateTime $AccountDate) |
||
276 | |||
277 | /** |
||
278 | * @return float |
||
279 | */ |
||
280 | public function getTotRoomRev() |
||
284 | |||
285 | /** |
||
286 | * @param float $TotRoomRev |
||
287 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
288 | */ |
||
289 | public function setTotRoomRev($TotRoomRev) |
||
294 | |||
295 | /** |
||
296 | * @return float |
||
297 | */ |
||
298 | public function getTotComm() |
||
302 | |||
303 | /** |
||
304 | * @param float $TotComm |
||
305 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
306 | */ |
||
307 | public function setTotComm($TotComm) |
||
312 | |||
313 | /** |
||
314 | * @return float |
||
315 | */ |
||
316 | public function getTotTax1() |
||
320 | |||
321 | /** |
||
322 | * @param float $TotTax1 |
||
323 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
324 | */ |
||
325 | public function setTotTax1($TotTax1) |
||
330 | |||
331 | /** |
||
332 | * @return float |
||
333 | */ |
||
334 | public function getTotTax2() |
||
338 | |||
339 | /** |
||
340 | * @param float $TotTax2 |
||
341 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
342 | */ |
||
343 | public function setTotTax2($TotTax2) |
||
348 | |||
349 | /** |
||
350 | * @return float |
||
351 | */ |
||
352 | public function getTotTax3() |
||
356 | |||
357 | /** |
||
358 | * @param float $TotTax3 |
||
359 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
360 | */ |
||
361 | public function setTotTax3($TotTax3) |
||
366 | |||
367 | /** |
||
368 | * @return float |
||
369 | */ |
||
370 | public function getTotOtherCB() |
||
374 | |||
375 | /** |
||
376 | * @param float $TotOtherCB |
||
377 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
378 | */ |
||
379 | public function setTotOtherCB($TotOtherCB) |
||
384 | |||
385 | /** |
||
386 | * @return float |
||
387 | */ |
||
388 | public function getTotReferal() |
||
392 | |||
393 | /** |
||
394 | * @param float $TotReferal |
||
395 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
396 | */ |
||
397 | public function setTotReferal($TotReferal) |
||
402 | |||
403 | /** |
||
404 | * @return float |
||
405 | */ |
||
406 | public function getTotCommCC() |
||
410 | |||
411 | /** |
||
412 | * @param float $TotCommCC |
||
413 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
414 | */ |
||
415 | public function setTotCommCC($TotCommCC) |
||
420 | |||
421 | /** |
||
422 | * @return float |
||
423 | */ |
||
424 | public function getDailyPct() |
||
428 | |||
429 | /** |
||
430 | * @param float $DailyPct |
||
431 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
432 | */ |
||
433 | public function setDailyPct($DailyPct) |
||
438 | |||
439 | /** |
||
440 | * @return int |
||
441 | */ |
||
442 | public function getBookingType() |
||
446 | |||
447 | /** |
||
448 | * @param int $BookingType |
||
449 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
450 | */ |
||
451 | public function setBookingType($BookingType) |
||
456 | |||
457 | /** |
||
458 | * @return int |
||
459 | */ |
||
460 | public function getSeqNo() |
||
464 | |||
465 | /** |
||
466 | * @param int $SeqNo |
||
467 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
468 | */ |
||
469 | public function setSeqNo($SeqNo) |
||
474 | |||
475 | /** |
||
476 | * @return \DateTime |
||
477 | */ |
||
478 | public function getArrivalDate() |
||
490 | |||
491 | /** |
||
492 | * @param \DateTime $ArrivalDate |
||
493 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
494 | */ |
||
495 | public function setArrivalDate(\DateTime $ArrivalDate) |
||
500 | |||
501 | /** |
||
502 | * @return \DateTime |
||
503 | */ |
||
504 | public function getDepartureDate() |
||
516 | |||
517 | /** |
||
518 | * @param \DateTime $DepartureDate |
||
519 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
520 | */ |
||
521 | public function setDepartureDate(\DateTime $DepartureDate) |
||
526 | |||
527 | /** |
||
528 | * @return int |
||
529 | */ |
||
530 | public function getArStatus() |
||
534 | |||
535 | /** |
||
536 | * @param int $ArStatus |
||
537 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
538 | */ |
||
539 | public function setArStatus($ArStatus) |
||
544 | |||
545 | /** |
||
546 | * @return \DateTime |
||
547 | */ |
||
548 | public function getDateArStatus() |
||
560 | |||
561 | /** |
||
562 | * @param \DateTime $DateArStatus |
||
563 | * @return \Gueststream\PMS\IQWare\API\DailyActivityAR |
||
564 | */ |
||
565 | public function setDateArStatus(\DateTime $DateArStatus) |
||
570 | } |
||
571 |
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..