1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Gueststream\PMS\IQWare\API; |
4
|
|
|
|
5
|
|
View Code Duplication |
class GetUnitsAvailability |
|
|
|
|
6
|
|
|
{ |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @var int $iGuid |
10
|
|
|
*/ |
11
|
|
|
protected $iGuid = 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 boolean $ShowOnlyUnitsAvailable |
25
|
|
|
*/ |
26
|
|
|
protected $ShowOnlyUnitsAvailable = null; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param int $iGuid |
30
|
|
|
* @param \DateTime $StartDate |
31
|
|
|
* @param \DateTime $EndDate |
32
|
|
|
* @param boolean $ShowOnlyUnitsAvailable |
33
|
|
|
*/ |
34
|
|
|
public function __construct($iGuid, \DateTime $StartDate, \DateTime $EndDate, $ShowOnlyUnitsAvailable) |
35
|
|
|
{ |
36
|
|
|
$this->iGuid = $iGuid; |
37
|
|
|
$this->StartDate = $StartDate->format(\DateTime::ATOM); |
|
|
|
|
38
|
|
|
$this->EndDate = $EndDate->format(\DateTime::ATOM); |
|
|
|
|
39
|
|
|
$this->ShowOnlyUnitsAvailable = $ShowOnlyUnitsAvailable; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return int |
44
|
|
|
*/ |
45
|
|
|
public function getIGuid() |
46
|
|
|
{ |
47
|
|
|
return $this->iGuid; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param int $iGuid |
52
|
|
|
* @return \Gueststream\PMS\IQWare\API\GetUnitsAvailability |
53
|
|
|
*/ |
54
|
|
|
public function setIGuid($iGuid) |
55
|
|
|
{ |
56
|
|
|
$this->iGuid = $iGuid; |
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\GetUnitsAvailability |
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\GetUnitsAvailability |
105
|
|
|
*/ |
106
|
|
|
public function setEndDate(\DateTime $EndDate) |
107
|
|
|
{ |
108
|
|
|
$this->EndDate = $EndDate->format(\DateTime::ATOM); |
|
|
|
|
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return boolean |
114
|
|
|
*/ |
115
|
|
|
public function getShowOnlyUnitsAvailable() |
116
|
|
|
{ |
117
|
|
|
return $this->ShowOnlyUnitsAvailable; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param boolean $ShowOnlyUnitsAvailable |
122
|
|
|
* @return \Gueststream\PMS\IQWare\API\GetUnitsAvailability |
123
|
|
|
*/ |
124
|
|
|
public function setShowOnlyUnitsAvailable($ShowOnlyUnitsAvailable) |
125
|
|
|
{ |
126
|
|
|
$this->ShowOnlyUnitsAvailable = $ShowOnlyUnitsAvailable; |
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.