UnitAvailable::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 8
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 UnitAvailable
6
{
7
8
    /**
9
     * @var int $ID_Room
10
     */
11
    protected $ID_Room = null;
12
13
    /**
14
     * @var string $RoomNo
15
     */
16
    protected $RoomNo = null;
17
18
    /**
19
     * @var int $ID_RoomType
20
     */
21
    protected $ID_RoomType = null;
22
23
    /**
24
     * @var int $ID_Address
25
     */
26
    protected $ID_Address = null;
27
28
    /**
29
     * @var int $ID_Bedding
30
     */
31
    protected $ID_Bedding = null;
32
33
    /**
34
     * @var int $ID_Floor
35
     */
36
    protected $ID_Floor = null;
37
38
    /**
39
     * @var \DateTime $ADate
40
     */
41
    protected $ADate = null;
42
43
    /**
44
     * @var boolean $IsAvailable
45
     */
46
    protected $IsAvailable = null;
47
48
    /**
49
     * @var int $RoomCategory
50
     */
51
    protected $RoomCategory = null;
52
53
    /**
54
     * @param int $ID_Room
55
     * @param int $ID_RoomType
56
     * @param int $ID_Address
57
     * @param int $ID_Bedding
58
     * @param int $ID_Floor
59
     * @param \DateTime $ADate
60
     * @param boolean $IsAvailable
61
     * @param int $RoomCategory
62
     */
63
    public function __construct($ID_Room, $ID_RoomType, $ID_Address, $ID_Bedding, $ID_Floor, \DateTime $ADate, $IsAvailable, $RoomCategory)
64
    {
65
        $this->ID_Room = $ID_Room;
66
        $this->ID_RoomType = $ID_RoomType;
67
        $this->ID_Address = $ID_Address;
68
        $this->ID_Bedding = $ID_Bedding;
69
        $this->ID_Floor = $ID_Floor;
70
        $this->ADate = $ADate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ADate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ADate.

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...
71
        $this->IsAvailable = $IsAvailable;
72
        $this->RoomCategory = $RoomCategory;
73
    }
74
75
    /**
76
     * @return int
77
     */
78
    public function getID_Room()
79
    {
80
        return $this->ID_Room;
81
    }
82
83
    /**
84
     * @param int $ID_Room
85
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
86
     */
87
    public function setID_Room($ID_Room)
88
    {
89
        $this->ID_Room = $ID_Room;
90
        return $this;
91
    }
92
93
    /**
94
     * @return string
95
     */
96
    public function getRoomNo()
97
    {
98
        return $this->RoomNo;
99
    }
100
101
    /**
102
     * @param string $RoomNo
103
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
104
     */
105
    public function setRoomNo($RoomNo)
106
    {
107
        $this->RoomNo = $RoomNo;
108
        return $this;
109
    }
110
111
    /**
112
     * @return int
113
     */
114
    public function getID_RoomType()
115
    {
116
        return $this->ID_RoomType;
117
    }
118
119
    /**
120
     * @param int $ID_RoomType
121
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
122
     */
123
    public function setID_RoomType($ID_RoomType)
124
    {
125
        $this->ID_RoomType = $ID_RoomType;
126
        return $this;
127
    }
128
129
    /**
130
     * @return int
131
     */
132
    public function getID_Address()
133
    {
134
        return $this->ID_Address;
135
    }
136
137
    /**
138
     * @param int $ID_Address
139
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
140
     */
141
    public function setID_Address($ID_Address)
142
    {
143
        $this->ID_Address = $ID_Address;
144
        return $this;
145
    }
146
147
    /**
148
     * @return int
149
     */
150
    public function getID_Bedding()
151
    {
152
        return $this->ID_Bedding;
153
    }
154
155
    /**
156
     * @param int $ID_Bedding
157
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
158
     */
159
    public function setID_Bedding($ID_Bedding)
160
    {
161
        $this->ID_Bedding = $ID_Bedding;
162
        return $this;
163
    }
164
165
    /**
166
     * @return int
167
     */
168
    public function getID_Floor()
169
    {
170
        return $this->ID_Floor;
171
    }
172
173
    /**
174
     * @param int $ID_Floor
175
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
176
     */
177
    public function setID_Floor($ID_Floor)
178
    {
179
        $this->ID_Floor = $ID_Floor;
180
        return $this;
181
    }
182
183
    /**
184
     * @return \DateTime
185
     */
186
    public function getADate()
187
    {
188
        if ($this->ADate == null) {
189
            return null;
190
        } else {
191
            try {
192
                return new \DateTime($this->ADate);
193
            } catch (\Exception $e) {
194
                return false;
195
            }
196
        }
197
    }
198
199
    /**
200
     * @param \DateTime $ADate
201
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
202
     */
203
    public function setADate(\DateTime $ADate)
204
    {
205
        $this->ADate = $ADate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ADate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ADate.

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...
206
        return $this;
207
    }
208
209
    /**
210
     * @return boolean
211
     */
212
    public function getIsAvailable()
213
    {
214
        return $this->IsAvailable;
215
    }
216
217
    /**
218
     * @param boolean $IsAvailable
219
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
220
     */
221
    public function setIsAvailable($IsAvailable)
222
    {
223
        $this->IsAvailable = $IsAvailable;
224
        return $this;
225
    }
226
227
    /**
228
     * @return int
229
     */
230
    public function getRoomCategory()
231
    {
232
        return $this->RoomCategory;
233
    }
234
235
    /**
236
     * @param int $RoomCategory
237
     * @return \Gueststream\PMS\IQWare\API\UnitAvailable
238
     */
239
    public function setRoomCategory($RoomCategory)
240
    {
241
        $this->RoomCategory = $RoomCategory;
242
        return $this;
243
    }
244
}
245