1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Gueststream\PMS\IQWare\API; |
4
|
|
|
|
5
|
|
View Code Duplication |
class GetRoomsAndSuitesAvailability |
|
|
|
|
6
|
|
|
{ |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @var int $intGuid |
10
|
|
|
*/ |
11
|
|
|
protected $intGuid = null; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @var \DateTime $startdate |
15
|
|
|
*/ |
16
|
|
|
protected $startdate = null; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var \DateTime $enddate |
20
|
|
|
*/ |
21
|
|
|
protected $enddate = null; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var int $roomTypeID |
25
|
|
|
*/ |
26
|
|
|
protected $roomTypeID = null; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param int $intGuid |
30
|
|
|
* @param \DateTime $startdate |
31
|
|
|
* @param \DateTime $enddate |
32
|
|
|
* @param int $roomTypeID |
33
|
|
|
*/ |
34
|
|
|
public function __construct($intGuid, \DateTime $startdate, \DateTime $enddate, $roomTypeID) |
35
|
|
|
{ |
36
|
|
|
$this->intGuid = $intGuid; |
37
|
|
|
$this->startdate = $startdate->format(\DateTime::ATOM); |
|
|
|
|
38
|
|
|
$this->enddate = $enddate->format(\DateTime::ATOM); |
|
|
|
|
39
|
|
|
$this->roomTypeID = $roomTypeID; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return int |
44
|
|
|
*/ |
45
|
|
|
public function getIntGuid() |
46
|
|
|
{ |
47
|
|
|
return $this->intGuid; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param int $intGuid |
52
|
|
|
* @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability |
53
|
|
|
*/ |
54
|
|
|
public function setIntGuid($intGuid) |
55
|
|
|
{ |
56
|
|
|
$this->intGuid = $intGuid; |
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return \DateTime |
62
|
|
|
*/ |
63
|
|
|
public function getStartdate() |
64
|
|
|
{ |
65
|
|
|
if ($this->startdate == null) { |
66
|
|
|
return null; |
67
|
|
|
} else { |
68
|
|
|
try { |
69
|
|
|
return new \DateTime($this->startdate); |
70
|
|
|
} catch (\Exception $e) { |
71
|
|
|
return false; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param \DateTime $startdate |
78
|
|
|
* @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability |
79
|
|
|
*/ |
80
|
|
|
public function setStartdate(\DateTime $startdate) |
81
|
|
|
{ |
82
|
|
|
$this->startdate = $startdate->format(\DateTime::ATOM); |
|
|
|
|
83
|
|
|
return $this; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return \DateTime |
88
|
|
|
*/ |
89
|
|
|
public function getEnddate() |
90
|
|
|
{ |
91
|
|
|
if ($this->enddate == null) { |
92
|
|
|
return null; |
93
|
|
|
} else { |
94
|
|
|
try { |
95
|
|
|
return new \DateTime($this->enddate); |
96
|
|
|
} catch (\Exception $e) { |
97
|
|
|
return false; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param \DateTime $enddate |
104
|
|
|
* @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability |
105
|
|
|
*/ |
106
|
|
|
public function setEnddate(\DateTime $enddate) |
107
|
|
|
{ |
108
|
|
|
$this->enddate = $enddate->format(\DateTime::ATOM); |
|
|
|
|
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return int |
114
|
|
|
*/ |
115
|
|
|
public function getRoomTypeID() |
116
|
|
|
{ |
117
|
|
|
return $this->roomTypeID; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param int $roomTypeID |
122
|
|
|
* @return \Gueststream\PMS\IQWare\API\GetRoomsAndSuitesAvailability |
123
|
|
|
*/ |
124
|
|
|
public function setRoomTypeID($roomTypeID) |
125
|
|
|
{ |
126
|
|
|
$this->roomTypeID = $roomTypeID; |
127
|
|
|
return $this; |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.