@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Set the start date. |
| 104 | 104 | * |
| 105 | - * @param DateTime $start_date |
|
| 105 | + * @param \DateTime $start_date |
|
| 106 | 106 | */ |
| 107 | 107 | public function setStartDate(\DateTime $start_date) { |
| 108 | 108 | $this->start_date = clone($start_date); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /** |
| 129 | 129 | * Set the end date. |
| 130 | 130 | * |
| 131 | - * @param DateTime $end_date |
|
| 131 | + * @param \DateTime $end_date |
|
| 132 | 132 | */ |
| 133 | 133 | public function setEndDate(\DateTime $end_date) { |
| 134 | 134 | $this->end_date = clone($end_date); |
@@ -240,6 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | 242 | * {@inheritdoc} |
| 243 | + * @param \DateTime $date |
|
| 243 | 244 | */ |
| 244 | 245 | public function isLastMonth($date) { |
| 245 | 246 | if ($date->format("n") == $this->endMonth() && $date->format("Y") == $this->endYear()) { |
@@ -535,7 +536,7 @@ discard block |
||
| 535 | 536 | /** |
| 536 | 537 | * Saves an event to whatever Drupal tables are defined in the store array |
| 537 | 538 | * |
| 538 | - * @param \ROomify\Bat\\Store\Store $store |
|
| 539 | + * @param Store $store |
|
| 539 | 540 | * @param string $granularity |
| 540 | 541 | * |
| 541 | 542 | * @throws \Exception |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $current_states = array_keys($unit_states); |
| 124 | 124 | // Compare the current states with the set of valid states |
| 125 | 125 | $remaining_states = array_diff($current_states, $valid_states); |
| 126 | - if (count($remaining_states) == 0 ) { |
|
| 126 | + if (count($remaining_states) == 0) { |
|
| 127 | 127 | // Unit is in a state that is within the set of valid states so add to result set |
| 128 | 128 | $units[$unit] = $unit; |
| 129 | 129 | $response->addMatch($keyed_units[$unit], CalendarResponse::VALID_STATE); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | foreach ($months as $month => $days) { |
| 213 | 213 | foreach ($days as $day => $hours) { |
| 214 | 214 | foreach ($hours as $hour => $value) { |
| 215 | - $events[$unit][Event::BAT_HOUR][$year][$month]['d'.$day][$hour] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value); |
|
| 215 | + $events[$unit][Event::BAT_HOUR][$year][$month]['d' . $day][$hour] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | foreach ($hours as $hour => $minutes) { |
| 227 | 227 | foreach ($minutes as $minute => $value) { |
| 228 | 228 | if (isset($db_events[$unit][Event::BAT_MINUTE][$year][$month][$day][$hour][$minute])) { |
| 229 | - $events[$unit][Event::BAT_MINUTE][$year][$month]['d' .$day]['h'.$hour][$minute] = ((int)$db_events[$unit][BAT_DAY][$year][$month][$day][$hour][$minute] == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$db_events[$unit][BAT_DAY][$year][$month][$day][$hour][$minute]); |
|
| 229 | + $events[$unit][Event::BAT_MINUTE][$year][$month]['d' . $day]['h' . $hour][$minute] = ((int)$db_events[$unit][BAT_DAY][$year][$month][$day][$hour][$minute] == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$db_events[$unit][BAT_DAY][$year][$month][$day][$hour][$minute]); |
|
| 230 | 230 | } |
| 231 | 231 | else { |
| 232 | 232 | // If nothing from db - then revert to the defaults |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | foreach ($days as $day => $hours) { |
| 245 | 245 | foreach ($hours as $hour => $minutes) { |
| 246 | 246 | foreach ($minutes as $minute => $value) { |
| 247 | - $events[$unit][Event::BAT_MINUTE][$year][$month]['d'.$day]['h'.$hour][$minute] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value); |
|
| 247 | + $events[$unit][Event::BAT_MINUTE][$year][$month]['d' . $day]['h' . $hour][$minute] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | // Value just switched - let us wrap up with current event and start a new one |
| 317 | 317 | $normalized_events[$unit][] = new Event($start_event, $end_event, $unit, $current_value); |
| 318 | 318 | $start_event = clone($end_event->add(new \DateInterval('PT1M'))); |
| 319 | - $end_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute,1)); |
|
| 319 | + $end_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute, 1)); |
|
| 320 | 320 | $current_value = $minute_value; |
| 321 | 321 | } |
| 322 | 322 | if ($current_value === NULL) { |
| 323 | 323 | // We are down to minutes and haven't created and event yet - do one now |
| 324 | - $start_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute,1)); |
|
| 324 | + $start_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute, 1)); |
|
| 325 | 325 | $end_event = clone($start_event); |
| 326 | 326 | } |
| 327 | 327 | $current_value = $minute_value; |