getRates::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 0
cts 13
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 10
crap 2

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace Gueststream\PMS\IQWare\API;
4
5
class getRates
6
{
7
8
    /**
9
     * @var int $intGUID
10
     */
11
    protected $intGUID = 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 $strISOLanguage
30
     */
31
    protected $strISOLanguage = null;
32
33
    /**
34
     * @var string $strChildren
35
     */
36
    protected $strChildren = null;
37
38
    /**
39
     * @var string $strAttributes
40
     */
41
    protected $strAttributes = null;
42
43
    /**
44
     * @var string $strLocations
45
     */
46
    protected $strLocations = null;
47
48
    /**
49
     * @var string $strAttributeGroupings
50
     */
51
    protected $strAttributeGroupings = null;
52
53
    /**
54
     * @var string $strLocationsGroupings
55
     */
56
    protected $strLocationsGroupings = null;
57
58
    /**
59
     * @param int $intGUID
60
     * @param \DateTime $dtArrivalDate
61
     * @param \DateTime $dtDepartureDate
62
     * @param int $intGuestCount
63
     * @param string $strISOLanguage
64
     * @param string $strChildren
65
     * @param string $strAttributes
66
     * @param string $strLocations
67
     * @param string $strAttributeGroupings
68
     * @param string $strLocationsGroupings
69
     */
70
    public function __construct($intGUID, \DateTime $dtArrivalDate, \DateTime $dtDepartureDate, $intGuestCount, $strISOLanguage, $strChildren, $strAttributes, $strLocations, $strAttributeGroupings, $strLocationsGroupings)
71
    {
72
        $this->intGUID = $intGUID;
73
        $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...
74
        $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...
75
        $this->intGuestCount = $intGuestCount;
76
        $this->strISOLanguage = $strISOLanguage;
77
        $this->strChildren = $strChildren;
78
        $this->strAttributes = $strAttributes;
79
        $this->strLocations = $strLocations;
80
        $this->strAttributeGroupings = $strAttributeGroupings;
81
        $this->strLocationsGroupings = $strLocationsGroupings;
82
    }
83
84
    /**
85
     * @return int
86
     */
87
    public function getIntGUID()
88
    {
89
        return $this->intGUID;
90
    }
91
92
    /**
93
     * @param int $intGUID
94
     * @return \Gueststream\PMS\IQWare\API\getRates
95
     */
96
    public function setIntGUID($intGUID)
97
    {
98
        $this->intGUID = $intGUID;
99
        return $this;
100
    }
101
102
    /**
103
     * @return \DateTime
104
     */
105
    public function getDtArrivalDate()
106
    {
107
        if ($this->dtArrivalDate == null) {
108
            return null;
109
        } else {
110
            try {
111
                return new \DateTime($this->dtArrivalDate);
112
            } catch (\Exception $e) {
113
                return false;
114
            }
115
        }
116
    }
117
118
    /**
119
     * @param \DateTime $dtArrivalDate
120
     * @return \Gueststream\PMS\IQWare\API\getRates
121
     */
122
    public function setDtArrivalDate(\DateTime $dtArrivalDate)
123
    {
124
        $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...
125
        return $this;
126
    }
127
128
    /**
129
     * @return \DateTime
130
     */
131
    public function getDtDepartureDate()
132
    {
133
        if ($this->dtDepartureDate == null) {
134
            return null;
135
        } else {
136
            try {
137
                return new \DateTime($this->dtDepartureDate);
138
            } catch (\Exception $e) {
139
                return false;
140
            }
141
        }
142
    }
143
144
    /**
145
     * @param \DateTime $dtDepartureDate
146
     * @return \Gueststream\PMS\IQWare\API\getRates
147
     */
148
    public function setDtDepartureDate(\DateTime $dtDepartureDate)
149
    {
150
        $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...
151
        return $this;
152
    }
153
154
    /**
155
     * @return int
156
     */
157
    public function getIntGuestCount()
158
    {
159
        return $this->intGuestCount;
160
    }
161
162
    /**
163
     * @param int $intGuestCount
164
     * @return \Gueststream\PMS\IQWare\API\getRates
165
     */
166
    public function setIntGuestCount($intGuestCount)
167
    {
168
        $this->intGuestCount = $intGuestCount;
169
        return $this;
170
    }
171
172
    /**
173
     * @return string
174
     */
175
    public function getStrISOLanguage()
176
    {
177
        return $this->strISOLanguage;
178
    }
179
180
    /**
181
     * @param string $strISOLanguage
182
     * @return \Gueststream\PMS\IQWare\API\getRates
183
     */
184
    public function setStrISOLanguage($strISOLanguage)
185
    {
186
        $this->strISOLanguage = $strISOLanguage;
187
        return $this;
188
    }
189
190
    /**
191
     * @return string
192
     */
193
    public function getStrChildren()
194
    {
195
        return $this->strChildren;
196
    }
197
198
    /**
199
     * @param string $strChildren
200
     * @return \Gueststream\PMS\IQWare\API\getRates
201
     */
202
    public function setStrChildren($strChildren)
203
    {
204
        $this->strChildren = $strChildren;
205
        return $this;
206
    }
207
208
    /**
209
     * @return string
210
     */
211
    public function getStrAttributes()
212
    {
213
        return $this->strAttributes;
214
    }
215
216
    /**
217
     * @param string $strAttributes
218
     * @return \Gueststream\PMS\IQWare\API\getRates
219
     */
220
    public function setStrAttributes($strAttributes)
221
    {
222
        $this->strAttributes = $strAttributes;
223
        return $this;
224
    }
225
226
    /**
227
     * @return string
228
     */
229
    public function getStrLocations()
230
    {
231
        return $this->strLocations;
232
    }
233
234
    /**
235
     * @param string $strLocations
236
     * @return \Gueststream\PMS\IQWare\API\getRates
237
     */
238
    public function setStrLocations($strLocations)
239
    {
240
        $this->strLocations = $strLocations;
241
        return $this;
242
    }
243
244
    /**
245
     * @return string
246
     */
247
    public function getStrAttributeGroupings()
248
    {
249
        return $this->strAttributeGroupings;
250
    }
251
252
    /**
253
     * @param string $strAttributeGroupings
254
     * @return \Gueststream\PMS\IQWare\API\getRates
255
     */
256
    public function setStrAttributeGroupings($strAttributeGroupings)
257
    {
258
        $this->strAttributeGroupings = $strAttributeGroupings;
259
        return $this;
260
    }
261
262
    /**
263
     * @return string
264
     */
265
    public function getStrLocationsGroupings()
266
    {
267
        return $this->strLocationsGroupings;
268
    }
269
270
    /**
271
     * @param string $strLocationsGroupings
272
     * @return \Gueststream\PMS\IQWare\API\getRates
273
     */
274
    public function setStrLocationsGroupings($strLocationsGroupings)
275
    {
276
        $this->strLocationsGroupings = $strLocationsGroupings;
277
        return $this;
278
    }
279
}
280