cElement::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 15
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 12
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 cElement
6
{
7
8
    /**
9
     * @var int $ID_Element
10
     */
11
    protected $ID_Element = null;
12
13
    /**
14
     * @var \DateTime $Date
15
     */
16
    protected $Date = null;
17
18
    /**
19
     * @var int $PersonCount
20
     */
21
    protected $PersonCount = null;
22
23
    /**
24
     * @var int $AgeCat1
25
     */
26
    protected $AgeCat1 = null;
27
28
    /**
29
     * @var int $AgeCat2
30
     */
31
    protected $AgeCat2 = null;
32
33
    /**
34
     * @var int $AgeCat3
35
     */
36
    protected $AgeCat3 = null;
37
38
    /**
39
     * @var int $AgeCat4
40
     */
41
    protected $AgeCat4 = null;
42
43
    /**
44
     * @var int $AgeCat5
45
     */
46
    protected $AgeCat5 = null;
47
48
    /**
49
     * @var int $AgeCat6
50
     */
51
    protected $AgeCat6 = null;
52
53
    /**
54
     * @var int $AgeCat7
55
     */
56
    protected $AgeCat7 = null;
57
58
    /**
59
     * @var int $AgeCat8
60
     */
61
    protected $AgeCat8 = null;
62
63
    /**
64
     * @var int $Qty
65
     */
66
    protected $Qty = null;
67
68
    /**
69
     * @param int $ID_Element
70
     * @param \DateTime $Date
71
     * @param int $PersonCount
72
     * @param int $AgeCat1
73
     * @param int $AgeCat2
74
     * @param int $AgeCat3
75
     * @param int $AgeCat4
76
     * @param int $AgeCat5
77
     * @param int $AgeCat6
78
     * @param int $AgeCat7
79
     * @param int $AgeCat8
80
     * @param int $Qty
81
     */
82
    public function __construct($ID_Element, \DateTime $Date, $PersonCount, $AgeCat1, $AgeCat2, $AgeCat3, $AgeCat4, $AgeCat5, $AgeCat6, $AgeCat7, $AgeCat8, $Qty)
83
    {
84
        $this->ID_Element = $ID_Element;
85
        $this->Date = $Date->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $Date->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $Date.

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...
86
        $this->PersonCount = $PersonCount;
87
        $this->AgeCat1 = $AgeCat1;
88
        $this->AgeCat2 = $AgeCat2;
89
        $this->AgeCat3 = $AgeCat3;
90
        $this->AgeCat4 = $AgeCat4;
91
        $this->AgeCat5 = $AgeCat5;
92
        $this->AgeCat6 = $AgeCat6;
93
        $this->AgeCat7 = $AgeCat7;
94
        $this->AgeCat8 = $AgeCat8;
95
        $this->Qty = $Qty;
96
    }
97
98
    /**
99
     * @return int
100
     */
101
    public function getID_Element()
102
    {
103
        return $this->ID_Element;
104
    }
105
106
    /**
107
     * @param int $ID_Element
108
     * @return \Gueststream\PMS\IQWare\API\cElement
109
     */
110
    public function setID_Element($ID_Element)
111
    {
112
        $this->ID_Element = $ID_Element;
113
        return $this;
114
    }
115
116
    /**
117
     * @return \DateTime
118
     */
119
    public function getDate()
120
    {
121
        if ($this->Date == null) {
122
            return null;
123
        } else {
124
            try {
125
                return new \DateTime($this->Date);
126
            } catch (\Exception $e) {
127
                return false;
128
            }
129
        }
130
    }
131
132
    /**
133
     * @param \DateTime $Date
134
     * @return \Gueststream\PMS\IQWare\API\cElement
135
     */
136
    public function setDate(\DateTime $Date)
137
    {
138
        $this->Date = $Date->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $Date->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $Date.

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...
139
        return $this;
140
    }
141
142
    /**
143
     * @return int
144
     */
145
    public function getPersonCount()
146
    {
147
        return $this->PersonCount;
148
    }
149
150
    /**
151
     * @param int $PersonCount
152
     * @return \Gueststream\PMS\IQWare\API\cElement
153
     */
154
    public function setPersonCount($PersonCount)
155
    {
156
        $this->PersonCount = $PersonCount;
157
        return $this;
158
    }
159
160
    /**
161
     * @return int
162
     */
163
    public function getAgeCat1()
164
    {
165
        return $this->AgeCat1;
166
    }
167
168
    /**
169
     * @param int $AgeCat1
170
     * @return \Gueststream\PMS\IQWare\API\cElement
171
     */
172
    public function setAgeCat1($AgeCat1)
173
    {
174
        $this->AgeCat1 = $AgeCat1;
175
        return $this;
176
    }
177
178
    /**
179
     * @return int
180
     */
181
    public function getAgeCat2()
182
    {
183
        return $this->AgeCat2;
184
    }
185
186
    /**
187
     * @param int $AgeCat2
188
     * @return \Gueststream\PMS\IQWare\API\cElement
189
     */
190
    public function setAgeCat2($AgeCat2)
191
    {
192
        $this->AgeCat2 = $AgeCat2;
193
        return $this;
194
    }
195
196
    /**
197
     * @return int
198
     */
199
    public function getAgeCat3()
200
    {
201
        return $this->AgeCat3;
202
    }
203
204
    /**
205
     * @param int $AgeCat3
206
     * @return \Gueststream\PMS\IQWare\API\cElement
207
     */
208
    public function setAgeCat3($AgeCat3)
209
    {
210
        $this->AgeCat3 = $AgeCat3;
211
        return $this;
212
    }
213
214
    /**
215
     * @return int
216
     */
217
    public function getAgeCat4()
218
    {
219
        return $this->AgeCat4;
220
    }
221
222
    /**
223
     * @param int $AgeCat4
224
     * @return \Gueststream\PMS\IQWare\API\cElement
225
     */
226
    public function setAgeCat4($AgeCat4)
227
    {
228
        $this->AgeCat4 = $AgeCat4;
229
        return $this;
230
    }
231
232
    /**
233
     * @return int
234
     */
235
    public function getAgeCat5()
236
    {
237
        return $this->AgeCat5;
238
    }
239
240
    /**
241
     * @param int $AgeCat5
242
     * @return \Gueststream\PMS\IQWare\API\cElement
243
     */
244
    public function setAgeCat5($AgeCat5)
245
    {
246
        $this->AgeCat5 = $AgeCat5;
247
        return $this;
248
    }
249
250
    /**
251
     * @return int
252
     */
253
    public function getAgeCat6()
254
    {
255
        return $this->AgeCat6;
256
    }
257
258
    /**
259
     * @param int $AgeCat6
260
     * @return \Gueststream\PMS\IQWare\API\cElement
261
     */
262
    public function setAgeCat6($AgeCat6)
263
    {
264
        $this->AgeCat6 = $AgeCat6;
265
        return $this;
266
    }
267
268
    /**
269
     * @return int
270
     */
271
    public function getAgeCat7()
272
    {
273
        return $this->AgeCat7;
274
    }
275
276
    /**
277
     * @param int $AgeCat7
278
     * @return \Gueststream\PMS\IQWare\API\cElement
279
     */
280
    public function setAgeCat7($AgeCat7)
281
    {
282
        $this->AgeCat7 = $AgeCat7;
283
        return $this;
284
    }
285
286
    /**
287
     * @return int
288
     */
289
    public function getAgeCat8()
290
    {
291
        return $this->AgeCat8;
292
    }
293
294
    /**
295
     * @param int $AgeCat8
296
     * @return \Gueststream\PMS\IQWare\API\cElement
297
     */
298
    public function setAgeCat8($AgeCat8)
299
    {
300
        $this->AgeCat8 = $AgeCat8;
301
        return $this;
302
    }
303
304
    /**
305
     * @return int
306
     */
307
    public function getQty()
308
    {
309
        return $this->Qty;
310
    }
311
312
    /**
313
     * @param int $Qty
314
     * @return \Gueststream\PMS\IQWare\API\cElement
315
     */
316
    public function setQty($Qty)
317
    {
318
        $this->Qty = $Qty;
319
        return $this;
320
    }
321
}
322