GetAvailRatesAndRoomNumbers   B
last analyzed

Complexity

Total Complexity 41

Size/Duplication

Total Lines 475
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 41
lcom 2
cbo 0
dl 0
loc 475
ccs 0
cts 199
cp 0
rs 8.2769
c 0
b 0
f 0

37 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 21 1
A getIGuids() 0 4 1
A setIGuids() 0 5 1
A getDtArrivalDate() 0 12 3
A setDtArrivalDate() 0 5 1
A getDtDepartureDate() 0 12 3
A setDtDepartureDate() 0 5 1
A getIntGuestCount() 0 4 1
A setIntGuestCount() 0 5 1
A getStrChildrens() 0 4 1
A setStrChildrens() 0 5 1
A getStrISOLanguageCode() 0 4 1
A setStrISOLanguageCode() 0 5 1
A getIntID_AccommodationType() 0 4 1
A setIntID_AccommodationType() 0 5 1
A getIntRoomQty() 0 4 1
A setIntRoomQty() 0 5 1
A getStrListOfPromoRates() 0 4 1
A setStrListOfPromoRates() 0 5 1
A getIsPromoByRate() 0 4 1
A setIsPromoByRate() 0 5 1
A getIntRateSpecial() 0 4 1
A setIntRateSpecial() 0 5 1
A getStrRateCodes() 0 4 1
A setStrRateCodes() 0 5 1
A getStrRoomTypes() 0 4 1
A setStrRoomTypes() 0 5 1
A getStrRoomAttributeIDs() 0 4 1
A setStrRoomAttributeIDs() 0 5 1
A getStrRoomLocationIDs() 0 4 1
A setStrRoomLocationIDs() 0 5 1
A getPushID() 0 4 1
A setPushID() 0 5 1
A getBackToBackMode() 0 4 1
A setBackToBackMode() 0 5 1
A getIsClusterVersion() 0 4 1
A setIsClusterVersion() 0 5 1

How to fix   Complexity   

Complex Class

Complex classes like GetAvailRatesAndRoomNumbers 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 GetAvailRatesAndRoomNumbers, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Gueststream\PMS\IQWare\API;
4
5
class GetAvailRatesAndRoomNumbers
6
{
7
8
    /**
9
     * @var ArrayOfInt $iGuids
10
     */
11
    protected $iGuids = null;
12
13
    /**
14
     * @var \DateTime $dtArrivalDate
15
     */
16
    protected $dtArrivalDate = null;
17
18
    /**
19
     * @var \DateTime $dtDepartureDate
20
     */
21
    protected $dtDepartureDate = null;
22
23
    /**
24
     * @var int $intGuestCount
25
     */
26
    protected $intGuestCount = null;
27
28
    /**
29
     * @var string $strChildrens
30
     */
31
    protected $strChildrens = null;
32
33
    /**
34
     * @var string $strISOLanguageCode
35
     */
36
    protected $strISOLanguageCode = null;
37
38
    /**
39
     * @var int $intID_AccommodationType
40
     */
41
    protected $intID_AccommodationType = null;
42
43
    /**
44
     * @var int $intRoomQty
45
     */
46
    protected $intRoomQty = null;
47
48
    /**
49
     * @var string $strListOfPromoRates
50
     */
51
    protected $strListOfPromoRates = null;
52
53
    /**
54
     * @var boolean $IsPromoByRate
55
     */
56
    protected $IsPromoByRate = null;
57
58
    /**
59
     * @var int $intRateSpecial
60
     */
61
    protected $intRateSpecial = null;
62
63
    /**
64
     * @var string $strRateCodes
65
     */
66
    protected $strRateCodes = null;
67
68
    /**
69
     * @var string $strRoomTypes
70
     */
71
    protected $strRoomTypes = null;
72
73
    /**
74
     * @var string $strRoomAttributeIDs
75
     */
76
    protected $strRoomAttributeIDs = null;
77
78
    /**
79
     * @var string $strRoomLocationIDs
80
     */
81
    protected $strRoomLocationIDs = null;
82
83
    /**
84
     * @var string $PushID
85
     */
86
    protected $PushID = null;
87
88
    /**
89
     * @var IAB2BMode $BackToBackMode
90
     */
91
    protected $BackToBackMode = null;
92
93
    /**
94
     * @var boolean $IsClusterVersion
95
     */
96
    protected $IsClusterVersion = null;
97
98
    /**
99
     * @param ArrayOfInt $iGuids
100
     * @param \DateTime $dtArrivalDate
101
     * @param \DateTime $dtDepartureDate
102
     * @param int $intGuestCount
103
     * @param string $strChildrens
104
     * @param string $strISOLanguageCode
105
     * @param int $intID_AccommodationType
106
     * @param int $intRoomQty
107
     * @param string $strListOfPromoRates
108
     * @param boolean $IsPromoByRate
109
     * @param int $intRateSpecial
110
     * @param string $strRateCodes
111
     * @param string $strRoomTypes
112
     * @param string $strRoomAttributeIDs
113
     * @param string $strRoomLocationIDs
114
     * @param string $PushID
115
     * @param IAB2BMode $BackToBackMode
116
     * @param boolean $IsClusterVersion
117
     */
118
    public function __construct($iGuids, \DateTime $dtArrivalDate, \DateTime $dtDepartureDate, $intGuestCount, $strChildrens, $strISOLanguageCode, $intID_AccommodationType, $intRoomQty, $strListOfPromoRates, $IsPromoByRate, $intRateSpecial, $strRateCodes, $strRoomTypes, $strRoomAttributeIDs, $strRoomLocationIDs, $PushID, $BackToBackMode, $IsClusterVersion)
119
    {
120
        $this->iGuids = $iGuids;
121
        $this->dtArrivalDate = $dtArrivalDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $dtArrivalDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $dtArrivalDate.

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..

Loading history...
122
        $this->dtDepartureDate = $dtDepartureDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $dtDepartureDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $dtDepartureDate.

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..

Loading history...
123
        $this->intGuestCount = $intGuestCount;
124
        $this->strChildrens = $strChildrens;
125
        $this->strISOLanguageCode = $strISOLanguageCode;
126
        $this->intID_AccommodationType = $intID_AccommodationType;
127
        $this->intRoomQty = $intRoomQty;
128
        $this->strListOfPromoRates = $strListOfPromoRates;
129
        $this->IsPromoByRate = $IsPromoByRate;
130
        $this->intRateSpecial = $intRateSpecial;
131
        $this->strRateCodes = $strRateCodes;
132
        $this->strRoomTypes = $strRoomTypes;
133
        $this->strRoomAttributeIDs = $strRoomAttributeIDs;
134
        $this->strRoomLocationIDs = $strRoomLocationIDs;
135
        $this->PushID = $PushID;
136
        $this->BackToBackMode = $BackToBackMode;
137
        $this->IsClusterVersion = $IsClusterVersion;
138
    }
139
140
    /**
141
     * @return ArrayOfInt
142
     */
143
    public function getIGuids()
144
    {
145
        return $this->iGuids;
146
    }
147
148
    /**
149
     * @param ArrayOfInt $iGuids
150
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
151
     */
152
    public function setIGuids($iGuids)
153
    {
154
        $this->iGuids = $iGuids;
155
        return $this;
156
    }
157
158
    /**
159
     * @return \DateTime
160
     */
161
    public function getDtArrivalDate()
162
    {
163
        if ($this->dtArrivalDate == null) {
164
            return null;
165
        } else {
166
            try {
167
                return new \DateTime($this->dtArrivalDate);
168
            } catch (\Exception $e) {
169
                return false;
170
            }
171
        }
172
    }
173
174
    /**
175
     * @param \DateTime $dtArrivalDate
176
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
177
     */
178
    public function setDtArrivalDate(\DateTime $dtArrivalDate)
179
    {
180
        $this->dtArrivalDate = $dtArrivalDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $dtArrivalDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $dtArrivalDate.

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..

Loading history...
181
        return $this;
182
    }
183
184
    /**
185
     * @return \DateTime
186
     */
187
    public function getDtDepartureDate()
188
    {
189
        if ($this->dtDepartureDate == null) {
190
            return null;
191
        } else {
192
            try {
193
                return new \DateTime($this->dtDepartureDate);
194
            } catch (\Exception $e) {
195
                return false;
196
            }
197
        }
198
    }
199
200
    /**
201
     * @param \DateTime $dtDepartureDate
202
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
203
     */
204
    public function setDtDepartureDate(\DateTime $dtDepartureDate)
205
    {
206
        $this->dtDepartureDate = $dtDepartureDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $dtDepartureDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $dtDepartureDate.

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..

Loading history...
207
        return $this;
208
    }
209
210
    /**
211
     * @return int
212
     */
213
    public function getIntGuestCount()
214
    {
215
        return $this->intGuestCount;
216
    }
217
218
    /**
219
     * @param int $intGuestCount
220
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
221
     */
222
    public function setIntGuestCount($intGuestCount)
223
    {
224
        $this->intGuestCount = $intGuestCount;
225
        return $this;
226
    }
227
228
    /**
229
     * @return string
230
     */
231
    public function getStrChildrens()
232
    {
233
        return $this->strChildrens;
234
    }
235
236
    /**
237
     * @param string $strChildrens
238
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
239
     */
240
    public function setStrChildrens($strChildrens)
241
    {
242
        $this->strChildrens = $strChildrens;
243
        return $this;
244
    }
245
246
    /**
247
     * @return string
248
     */
249
    public function getStrISOLanguageCode()
250
    {
251
        return $this->strISOLanguageCode;
252
    }
253
254
    /**
255
     * @param string $strISOLanguageCode
256
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
257
     */
258
    public function setStrISOLanguageCode($strISOLanguageCode)
259
    {
260
        $this->strISOLanguageCode = $strISOLanguageCode;
261
        return $this;
262
    }
263
264
    /**
265
     * @return int
266
     */
267
    public function getIntID_AccommodationType()
268
    {
269
        return $this->intID_AccommodationType;
270
    }
271
272
    /**
273
     * @param int $intID_AccommodationType
274
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
275
     */
276
    public function setIntID_AccommodationType($intID_AccommodationType)
277
    {
278
        $this->intID_AccommodationType = $intID_AccommodationType;
279
        return $this;
280
    }
281
282
    /**
283
     * @return int
284
     */
285
    public function getIntRoomQty()
286
    {
287
        return $this->intRoomQty;
288
    }
289
290
    /**
291
     * @param int $intRoomQty
292
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
293
     */
294
    public function setIntRoomQty($intRoomQty)
295
    {
296
        $this->intRoomQty = $intRoomQty;
297
        return $this;
298
    }
299
300
    /**
301
     * @return string
302
     */
303
    public function getStrListOfPromoRates()
304
    {
305
        return $this->strListOfPromoRates;
306
    }
307
308
    /**
309
     * @param string $strListOfPromoRates
310
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
311
     */
312
    public function setStrListOfPromoRates($strListOfPromoRates)
313
    {
314
        $this->strListOfPromoRates = $strListOfPromoRates;
315
        return $this;
316
    }
317
318
    /**
319
     * @return boolean
320
     */
321
    public function getIsPromoByRate()
322
    {
323
        return $this->IsPromoByRate;
324
    }
325
326
    /**
327
     * @param boolean $IsPromoByRate
328
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
329
     */
330
    public function setIsPromoByRate($IsPromoByRate)
331
    {
332
        $this->IsPromoByRate = $IsPromoByRate;
333
        return $this;
334
    }
335
336
    /**
337
     * @return int
338
     */
339
    public function getIntRateSpecial()
340
    {
341
        return $this->intRateSpecial;
342
    }
343
344
    /**
345
     * @param int $intRateSpecial
346
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
347
     */
348
    public function setIntRateSpecial($intRateSpecial)
349
    {
350
        $this->intRateSpecial = $intRateSpecial;
351
        return $this;
352
    }
353
354
    /**
355
     * @return string
356
     */
357
    public function getStrRateCodes()
358
    {
359
        return $this->strRateCodes;
360
    }
361
362
    /**
363
     * @param string $strRateCodes
364
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
365
     */
366
    public function setStrRateCodes($strRateCodes)
367
    {
368
        $this->strRateCodes = $strRateCodes;
369
        return $this;
370
    }
371
372
    /**
373
     * @return string
374
     */
375
    public function getStrRoomTypes()
376
    {
377
        return $this->strRoomTypes;
378
    }
379
380
    /**
381
     * @param string $strRoomTypes
382
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
383
     */
384
    public function setStrRoomTypes($strRoomTypes)
385
    {
386
        $this->strRoomTypes = $strRoomTypes;
387
        return $this;
388
    }
389
390
    /**
391
     * @return string
392
     */
393
    public function getStrRoomAttributeIDs()
394
    {
395
        return $this->strRoomAttributeIDs;
396
    }
397
398
    /**
399
     * @param string $strRoomAttributeIDs
400
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
401
     */
402
    public function setStrRoomAttributeIDs($strRoomAttributeIDs)
403
    {
404
        $this->strRoomAttributeIDs = $strRoomAttributeIDs;
405
        return $this;
406
    }
407
408
    /**
409
     * @return string
410
     */
411
    public function getStrRoomLocationIDs()
412
    {
413
        return $this->strRoomLocationIDs;
414
    }
415
416
    /**
417
     * @param string $strRoomLocationIDs
418
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
419
     */
420
    public function setStrRoomLocationIDs($strRoomLocationIDs)
421
    {
422
        $this->strRoomLocationIDs = $strRoomLocationIDs;
423
        return $this;
424
    }
425
426
    /**
427
     * @return string
428
     */
429
    public function getPushID()
430
    {
431
        return $this->PushID;
432
    }
433
434
    /**
435
     * @param string $PushID
436
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
437
     */
438
    public function setPushID($PushID)
439
    {
440
        $this->PushID = $PushID;
441
        return $this;
442
    }
443
444
    /**
445
     * @return IAB2BMode
446
     */
447
    public function getBackToBackMode()
448
    {
449
        return $this->BackToBackMode;
450
    }
451
452
    /**
453
     * @param IAB2BMode $BackToBackMode
454
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
455
     */
456
    public function setBackToBackMode($BackToBackMode)
457
    {
458
        $this->BackToBackMode = $BackToBackMode;
459
        return $this;
460
    }
461
462
    /**
463
     * @return boolean
464
     */
465
    public function getIsClusterVersion()
466
    {
467
        return $this->IsClusterVersion;
468
    }
469
470
    /**
471
     * @param boolean $IsClusterVersion
472
     * @return \Gueststream\PMS\IQWare\API\GetAvailRatesAndRoomNumbers
473
     */
474
    public function setIsClusterVersion($IsClusterVersion)
475
    {
476
        $this->IsClusterVersion = $IsClusterVersion;
477
        return $this;
478
    }
479
}
480