@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * Returns the start date. |
92 | 92 | * |
93 | - * @return DateTime |
|
93 | + * @return \DateTime |
|
94 | 94 | */ |
95 | 95 | public function getStartDate() { |
96 | 96 | return clone($this->start_date); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * Set the start date. |
109 | 109 | * |
110 | - * @param DateTime $start_date |
|
110 | + * @param \DateTime $start_date |
|
111 | 111 | */ |
112 | 112 | public function setStartDate(\DateTime $start_date) { |
113 | 113 | $this->start_date = clone($start_date); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | /** |
117 | 117 | * Returns the end date. |
118 | 118 | * |
119 | - * @return DateTime |
|
119 | + * @return \DateTime |
|
120 | 120 | */ |
121 | 121 | public function getEndDate() { |
122 | 122 | return clone($this->end_date); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | /** |
134 | 134 | * Set the end date. |
135 | 135 | * |
136 | - * @param DateTime $end_date |
|
136 | + * @param \DateTime $end_date |
|
137 | 137 | */ |
138 | 138 | public function setEndDate(\DateTime $end_date) { |
139 | 139 | $this->end_date = clone($end_date); |
@@ -451,6 +451,7 @@ discard block |
||
451 | 451 | /** |
452 | 452 | * Transforms the event in a breakdown of days, hours and minutes with associated states. |
453 | 453 | * |
454 | + * @param EventItemizer $itemizer |
|
454 | 455 | * @return array |
455 | 456 | */ |
456 | 457 | public function itemize($itemizer, $granularity = AbstractEvent::BAT_HOURLY) { |
@@ -461,7 +462,7 @@ discard block |
||
461 | 462 | /** |
462 | 463 | * Saves an event using the Store object |
463 | 464 | * |
464 | - * @param \Roomify\Bat\\Store\Store $store |
|
465 | + * @param Store $store |
|
465 | 466 | * @param string $granularity |
466 | 467 | * |
467 | 468 | * @return boolean |
@@ -342,8 +342,7 @@ |
||
342 | 342 | if ($this->dateIsEarlier($start) && |
343 | 343 | ($this->dateIsInRange($end) || $this->dateIsLater($end))) { |
344 | 344 | $overlaps = TRUE; |
345 | - } |
|
346 | - elseif ($this->dateIsInRange($start) && |
|
345 | + } elseif ($this->dateIsInRange($start) && |
|
347 | 346 | ($this->dateIsInRange($end) || $this->dateIsLater($end))) { |
348 | 347 | $overlaps = TRUE; |
349 | 348 | } |
@@ -32,7 +32,6 @@ |
||
32 | 32 | * [BAT_DAY][2016][01][d1][-1] - The first day starts at 1210 so the DAY array is not enough |
33 | 33 | * [BAT_DAY][2016][01][d2][10] - The second day is a full day at the same value of 10 |
34 | 34 | * [BAT_DAY][2016][01][d3][-1] - The last day is no a full day so the day array in non-determinant |
35 | - |
|
36 | 35 | * [BAT_HOUR][2016][01][d1][h12][-1] - The first hour of the event starts at 10 minutes so the hour is non-determinant |
37 | 36 | * [BAT_HOUR][2016][01][d1][h13][10] |
38 | 37 | * [BAT_HOUR][2016][01][d1][h14][10] |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | $start = TRUE; |
135 | 135 | |
136 | 136 | // Cycle through each month |
137 | - foreach($daterange as $date) { |
|
137 | + foreach ($daterange as $date) { |
|
138 | 138 | |
139 | 139 | // Check if we have |
140 | - if (($date->format('Y-n') != $old_month) || ($start)) { |
|
140 | + if (($date->format('Y-n') != $old_month) || ($start)) { |
|
141 | 141 | |
142 | 142 | $year = $date->format("Y"); |
143 | 143 | $dayinterval = new \DateInterval('P1D'); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | // Deal with the end date unless it ends just before midnight at which point we don't need to go further |
234 | - if ($this->event->getEndDate()->format('H:i') == '23:59' ) { |
|
234 | + if ($this->event->getEndDate()->format('H:i') == '23:59') { |
|
235 | 235 | $itemized[EventItemizer::BAT_HOUR][$ey][$em]['d' . $ed] = array(); |
236 | 236 | $itemized[EventItemizer::BAT_MINUTE][$ey][$em]['d' . $ed] = array(); |
237 | 237 | } else { |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | |
260 | 260 | $counter = (int)$period_start->format('i'); |
261 | 261 | $start_minute = $counter; |
262 | - foreach($period as $minute) { |
|
262 | + foreach ($period as $minute) { |
|
263 | 263 | // Doing minutes so set the values in the minute array |
264 | - $itemized[EventItemizer::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')]['m' .$minute->format('i')] = $this->event->getValue(); |
|
264 | + $itemized[EventItemizer::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')]['m' . $minute->format('i')] = $this->event->getValue(); |
|
265 | 265 | // Let the hours know that it cannot determine availability |
266 | - $itemized[EventItemizer::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')] = -1; |
|
266 | + $itemized[EventItemizer::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = -1; |
|
267 | 267 | $counter++; |
268 | 268 | |
269 | - if ($counter == 60 && $start_minute!==0) { |
|
269 | + if ($counter == 60 && $start_minute !== 0) { |
|
270 | 270 | // Not a real hour - leave as is and move on |
271 | 271 | $counter = 0; |
272 | 272 | $start_minute = 0; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | // Did a real whole hour so initialize the hour |
276 | 276 | $itemized[EventItemizer::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = $this->event->getValue(); |
277 | 277 | // We have a whole hour so get rid of the minute info |
278 | - unset($itemized[EventItemizer::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')]); |
|
278 | + unset($itemized[EventItemizer::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')]); |
|
279 | 279 | $counter = 0; |
280 | 280 | $start_minute = 0; |
281 | 281 | } |
@@ -147,8 +147,7 @@ discard block |
||
147 | 147 | // If we are in the same month the end date is the end date of the event |
148 | 148 | if ($this->event->isSameMonth()) { |
149 | 149 | $dayrange = new \DatePeriod($this->event->getStartDate(), $dayinterval, new \DateTime($this->event->getEndDate()->format("Y-n-j 23:59:59"))); |
150 | - } |
|
151 | - else { // alternatively it is the last day of the start month |
|
150 | + } else { // alternatively it is the last day of the start month |
|
152 | 151 | $dayrange = new \DatePeriod($this->event->getStartDate(), $dayinterval, $this->event->endMonthDate($this->event->getStartDate())); |
153 | 152 | } |
154 | 153 | foreach ($dayrange as $day) { |
@@ -214,8 +213,7 @@ discard block |
||
214 | 213 | $itemized[EventItemizer::BAT_HOUR][$sy][$sm]['d' . $sd] = $itemized_same_day[EventItemizer::BAT_HOUR][$sy][$sm]['d' . $sd]; |
215 | 214 | $itemized[EventItemizer::BAT_MINUTE][$sy][$sm]['d' . $sd] = $itemized_same_day[EventItemizer::BAT_MINUTE][$sy][$sm]['d' . $sd]; |
216 | 215 | } |
217 | - } |
|
218 | - else { |
|
216 | + } else { |
|
219 | 217 | // Deal with the start day unless it starts on midnight precisely at which point the whole day is booked |
220 | 218 | if (!($this->event->getStartDate()->format('H:i') == '00:00')) { |
221 | 219 | $start_period = new \DatePeriod($start_date, $interval, new \DateTime($start_date->format("Y-n-j 23:59:59"))); |
@@ -223,8 +221,7 @@ discard block |
||
223 | 221 | $itemized[EventItemizer::BAT_DAY][$sy][$sm]['d' . $sd] = -1; |
224 | 222 | $itemized[EventItemizer::BAT_HOUR][$sy][$sm]['d' . $sd] = $itemized_start[EventItemizer::BAT_HOUR][$sy][$sm]['d' . $sd]; |
225 | 223 | $itemized[EventItemizer::BAT_MINUTE][$sy][$sm]['d' . $sd] = $itemized_start[EventItemizer::BAT_MINUTE][$sy][$sm]['d' . $sd]; |
226 | - } |
|
227 | - else { |
|
224 | + } else { |
|
228 | 225 | // Just set an empty hour and minute |
229 | 226 | $itemized[EventItemizer::BAT_HOUR][$sy][$sm]['d' . $sd] = array(); |
230 | 227 | $itemized[EventItemizer::BAT_MINUTE][$sy][$sm]['d' . $sd] = array(); |
@@ -270,8 +267,7 @@ discard block |
||
270 | 267 | // Not a real hour - leave as is and move on |
271 | 268 | $counter = 0; |
272 | 269 | $start_minute = 0; |
273 | - } |
|
274 | - elseif ($counter == 60 && $start_minute == 0) { |
|
270 | + } elseif ($counter == 60 && $start_minute == 0) { |
|
275 | 271 | // Did a real whole hour so initialize the hour |
276 | 272 | $itemized[EventItemizer::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = $this->event->getValue(); |
277 | 273 | // We have a whole hour so get rid of the minute info |