1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DJStarCOM\BookingComSDK\Query; |
4
|
|
|
|
5
|
|
|
use DJStarCOM\BookingComSDK\Models\Hotel; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class HotelsQuery |
9
|
|
|
* @package DJStarCOM\BookingComSDK\Query |
10
|
|
|
*/ |
11
|
|
|
class HotelsQuery extends Query |
12
|
|
|
{ |
13
|
|
|
public const EXTRAS_HOTEL_DESCRIPTION = 'hotel_description'; |
14
|
|
|
public const EXTRAS_HOTEL_FACILITIES = 'hotel_facilities'; |
15
|
|
|
public const EXTRAS_HOTEL_INFO = 'hotel_info'; |
16
|
|
|
public const EXTRAS_HOTEL_PHOTOS = 'hotel_photos'; |
17
|
|
|
public const EXTRAS_HOTEL_POLICIES = 'hotel_policies'; |
18
|
|
|
public const EXTRAS_KEY_COLLECTION_INFO = 'key_collection_info'; |
19
|
|
|
public const EXTRAS_PAYMENT_DETAILS = 'payment_details'; |
20
|
|
|
public const EXTRAS_ROOM_DESCRIPTION = 'room_description'; |
21
|
|
|
public const EXTRAS_ROOM_FACILITIES = 'room_facilities'; |
22
|
|
|
public const EXTRAS_ROOM_INFO = 'room_info'; |
23
|
|
|
public const EXTRAS_ROOM_PHOTOS = 'room_photos'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
protected static $uri = '/hotels'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Limit the results to these cities. |
32
|
|
|
* |
33
|
|
|
* @var array |
34
|
|
|
*/ |
35
|
|
|
protected $city_ids; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Limit the results to these regions. |
39
|
|
|
* |
40
|
|
|
* @var array |
41
|
|
|
*/ |
42
|
|
|
protected $region_ids; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Limit the results to these country codes (cc1). |
46
|
|
|
* |
47
|
|
|
* @var array |
48
|
|
|
*/ |
49
|
|
|
protected $country_ids; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Limit the results to these districts. |
53
|
|
|
* |
54
|
|
|
* @var array |
55
|
|
|
*/ |
56
|
|
|
protected $district_ids; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Additional information available (via extras parameter) are: |
60
|
|
|
* hotel_description |
61
|
|
|
* hotel_facilities |
62
|
|
|
* hotel_info |
63
|
|
|
* hotel_photos |
64
|
|
|
* hotel_policies |
65
|
|
|
* key_collection_info |
66
|
|
|
* payment_details |
67
|
|
|
* room_description |
68
|
|
|
* room_facilities |
69
|
|
|
* room_info |
70
|
|
|
* room_photos |
71
|
|
|
* |
72
|
|
|
* @var array |
73
|
|
|
*/ |
74
|
|
|
protected $extras; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Limit the result to these hotels. |
78
|
|
|
* |
79
|
|
|
* @var array |
80
|
|
|
*/ |
81
|
|
|
protected $hotel_ids; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* The language code to return the results in. |
85
|
|
|
* |
86
|
|
|
* @var string |
87
|
|
|
*/ |
88
|
|
|
protected $language; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Where in the resulting list to start. This can be used together with {rows} to get the data in parts. |
92
|
|
|
* |
93
|
|
|
* @var integer |
94
|
|
|
*/ |
95
|
|
|
protected $offset; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* The maximum number of entries to return. This can be used together with {offset} to get the data in parts. |
99
|
|
|
* |
100
|
|
|
* @var integer |
101
|
|
|
*/ |
102
|
|
|
protected $rows; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return bool |
106
|
|
|
*/ |
107
|
|
|
public function isSecure(): bool |
108
|
|
|
{ |
109
|
|
|
return false; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return array |
114
|
|
|
*/ |
115
|
|
|
public function getCityIds(): ?array |
116
|
|
|
{ |
117
|
|
|
return $this->city_ids; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param array $city_ids |
122
|
|
|
* @return $this |
123
|
|
|
*/ |
124
|
|
|
public function setCityIds(array $city_ids): self |
125
|
|
|
{ |
126
|
|
|
$this->city_ids = $city_ids; |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return array |
133
|
|
|
*/ |
134
|
|
|
public function getCountryIds(): ?array |
135
|
|
|
{ |
136
|
|
|
return $this->country_ids; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param array $country_ids |
141
|
|
|
* @return $this |
142
|
|
|
*/ |
143
|
|
|
public function setCountryIds(array $country_ids): self |
144
|
|
|
{ |
145
|
|
|
$this->country_ids = $country_ids; |
146
|
|
|
|
147
|
|
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return array |
152
|
|
|
*/ |
153
|
|
|
public function getDistrictIds(): ?array |
154
|
|
|
{ |
155
|
|
|
return $this->district_ids; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param array $district_ids |
160
|
|
|
* @return $this |
161
|
|
|
*/ |
162
|
|
|
public function setDistrictIds(array $district_ids): self |
163
|
|
|
{ |
164
|
|
|
$this->district_ids = $district_ids; |
165
|
|
|
|
166
|
|
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @return array |
171
|
|
|
*/ |
172
|
|
|
public function getExtras(): ?array |
173
|
|
|
{ |
174
|
|
|
return $this->extras; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @param array $extras |
179
|
|
|
* @return $this |
180
|
|
|
*/ |
181
|
|
|
public function setExtras(array $extras): self |
182
|
|
|
{ |
183
|
|
|
$this->extras = $extras; |
184
|
|
|
|
185
|
|
|
return $this; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @return self |
190
|
|
|
*/ |
191
|
|
|
public function withExtras(): self |
192
|
|
|
{ |
193
|
|
|
$this->extras = [ |
194
|
|
|
self::EXTRAS_HOTEL_DESCRIPTION, |
195
|
|
|
self::EXTRAS_HOTEL_FACILITIES, |
196
|
|
|
self::EXTRAS_HOTEL_INFO, |
197
|
|
|
self::EXTRAS_HOTEL_PHOTOS, |
198
|
|
|
self::EXTRAS_HOTEL_POLICIES, |
199
|
|
|
self::EXTRAS_KEY_COLLECTION_INFO, |
200
|
|
|
self::EXTRAS_PAYMENT_DETAILS, |
201
|
|
|
self::EXTRAS_ROOM_DESCRIPTION, |
202
|
|
|
self::EXTRAS_ROOM_FACILITIES, |
203
|
|
|
self::EXTRAS_ROOM_INFO, |
204
|
|
|
self::EXTRAS_ROOM_PHOTOS, |
205
|
|
|
]; |
206
|
|
|
|
207
|
|
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @return array |
212
|
|
|
*/ |
213
|
|
|
public function getHotelIds(): ?array |
214
|
|
|
{ |
215
|
|
|
return $this->hotel_ids; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @param array $hotel_ids |
220
|
|
|
* @return $this |
221
|
|
|
*/ |
222
|
|
|
public function setHotelIds(array $hotel_ids): self |
223
|
|
|
{ |
224
|
|
|
$this->hotel_ids = $hotel_ids; |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return string |
231
|
|
|
*/ |
232
|
|
|
public function getLanguage(): ?string |
233
|
|
|
{ |
234
|
|
|
return $this->language; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @param string $language |
239
|
|
|
* @return $this |
240
|
|
|
*/ |
241
|
|
|
public function setLanguage(string $language): self |
242
|
|
|
{ |
243
|
|
|
$this->language = $language; |
244
|
|
|
|
245
|
|
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* @return int |
250
|
|
|
*/ |
251
|
|
|
public function getOffset(): ?int |
252
|
|
|
{ |
253
|
|
|
return $this->offset; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @param int $offset |
258
|
|
|
* @return $this |
259
|
|
|
*/ |
260
|
|
|
public function setOffset(int $offset): self |
261
|
|
|
{ |
262
|
|
|
$this->offset = $offset; |
263
|
|
|
|
264
|
|
|
return $this; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* @return int |
269
|
|
|
*/ |
270
|
|
|
public function getRows(): ?int |
271
|
|
|
{ |
272
|
|
|
return $this->rows; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* @param int $rows |
277
|
|
|
* @return $this |
278
|
|
|
*/ |
279
|
|
|
public function setRows(int $rows): self |
280
|
|
|
{ |
281
|
|
|
$this->rows = $rows; |
282
|
|
|
|
283
|
|
|
return $this; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* @return array |
288
|
|
|
*/ |
289
|
|
|
protected function getAttributeMap(): array |
290
|
|
|
{ |
291
|
|
|
return [ |
292
|
|
|
'city_ids' => 'array', |
293
|
|
|
'region_ids' => 'array', |
294
|
|
|
'country_ids' => 'array', |
295
|
|
|
'district_ids' => 'array', |
296
|
|
|
'extras' => 'array', |
297
|
|
|
'hotel_ids' => 'array', |
298
|
|
|
'language' => 'string', |
299
|
|
|
'offset' => 'integer', |
300
|
|
|
'rows' => 'integer', |
301
|
|
|
]; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* Specify Model class name. |
306
|
|
|
* |
307
|
|
|
* @return string |
308
|
|
|
*/ |
309
|
|
|
protected function model(): string |
310
|
|
|
{ |
311
|
|
|
return Hotel::class; |
312
|
|
|
} |
313
|
|
|
} |
314
|
|
|
|