GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 6ec345...990a2f )
by
unknown
15:12
created
src/Constraint/Constraint.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,6 @@
 block discarded – undo
7 7
 
8 8
 namespace Roomify\Bat\Constraint;
9 9
 
10
-use Roomify\Bat\ConstraintInterface;
11
-
12 10
 
13 11
 /**
14 12
  * A constraint acts as a filter that can be applied to a Calendar Response to
Please login to merge, or discard this patch.
src/Event/AbstractEvent.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
   /**
102 102
    * Set the start date.
103 103
    *
104
-   * @param DateTime $start_date
104
+   * @param \DateTime $start_date
105 105
    */
106 106
   public function setStartDate(\DateTime $start_date) {
107 107
     $this->start_date = clone($start_date);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
   /**
128 128
    * Set the end date.
129 129
    *
130
-   * @param DateTime $end_date
130
+   * @param \DateTime $end_date
131 131
    */
132 132
   public function setEndDate(\DateTime $end_date) {
133 133
     $this->end_date = clone($end_date);
@@ -239,6 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
   /**
241 241
    * {@inheritdoc}
242
+   * @param \DateTime $date
242 243
    */
243 244
   public function isLastMonth($date) {
244 245
     if ($date->format("n") == $this->endMonth() && $date->format("Y") == $this->endYear()) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -444,14 +444,14 @@  discard block
 block discarded – undo
444 444
 
445 445
     $counter = (int)$period_start->format('i');
446 446
     $start_minute = $counter;
447
-    foreach($period as $minute) {
447
+    foreach ($period as $minute) {
448 448
       // Doing minutes so set the values in the minute array
449
-      $itemized[BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')]['m' .$minute->format('i')] = $this->getValue();
449
+      $itemized[BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')]['m' . $minute->format('i')] = $this->getValue();
450 450
       // Let the hours know that it cannot determine availability
451
-      $itemized[BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')] = -1;
451
+      $itemized[BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = -1;
452 452
       $counter++;
453 453
 
454
-      if ($counter == 60 && $start_minute!==0) {
454
+      if ($counter == 60 && $start_minute !== 0) {
455 455
         // Not a real hour - leave as is and move on
456 456
         $counter = 0;
457 457
         $start_minute = 0;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         // Did a real whole hour so initialize the hour
461 461
         $itemized[BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = $this->getValue();
462 462
         // We have a whole hour so get rid of the minute info
463
-        unset($itemized[BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')]);
463
+        unset($itemized[BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')]);
464 464
         $counter = 0;
465 465
         $start_minute = 0;
466 466
       }
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
     // Set the end date to the last day of the month so that we are sure to get that last month
482 482
     $adjusted_end_day = new \DateTime($this->end_date->format('Y-n-t'));
483 483
 
484
-    $daterange = new \DatePeriod($this->start_date, $interval ,$adjusted_end_day);
484
+    $daterange = new \DatePeriod($this->start_date, $interval, $adjusted_end_day);
485 485
 
486 486
     $itemized = array();
487 487
 
488 488
     // Cycle through each month
489
-    foreach($daterange as $date) {
489
+    foreach ($daterange as $date) {
490 490
 
491 491
       $year = $date->format("Y");
492 492
       $dayinterval = new \DateInterval('P1D');
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -405,8 +405,7 @@  discard block
 block discarded – undo
405 405
         $itemized[BAT_HOUR][$sy][$sm]['d' . $sd] = $itemized_same_day[BAT_HOUR][$sy][$sm]['d' . $sd];
406 406
         $itemized[BAT_MINUTE][$sy][$sm]['d' . $sd] = $itemized_same_day[BAT_MINUTE][$sy][$sm]['d' . $sd];
407 407
       }
408
-    }
409
-    else {
408
+    } else {
410 409
       // Deal with the start day unless it starts on midnight precisely at which point the whole day is booked
411 410
       if (!($this->start_date->format('H:i') == '00:00')) {
412 411
         $start_period = new \DatePeriod($start_date, $interval, new \DateTime($start_date->format("Y-n-j 23:59:59")));
@@ -414,8 +413,7 @@  discard block
 block discarded – undo
414 413
         $itemized[BAT_DAY][$sy][$sm]['d' . $sd] = -1;
415 414
         $itemized[BAT_HOUR][$sy][$sm]['d' . $sd] = $itemized_start[BAT_HOUR][$sy][$sm]['d' . $sd];
416 415
         $itemized[BAT_MINUTE][$sy][$sm]['d' . $sd] = $itemized_start[BAT_MINUTE][$sy][$sm]['d' . $sd];
417
-      }
418
-      else {
416
+      } else {
419 417
         // Just set an empty hour and minute
420 418
         $itemized[BAT_HOUR][$sy][$sm]['d' . $sd] = array();
421 419
         $itemized[BAT_MINUTE][$sy][$sm]['d' . $sd] = array();
@@ -455,8 +453,7 @@  discard block
 block discarded – undo
455 453
         // Not a real hour - leave as is and move on
456 454
         $counter = 0;
457 455
         $start_minute = 0;
458
-      }
459
-      elseif ($counter == 60 && $start_minute == 0) {
456
+      } elseif ($counter == 60 && $start_minute == 0) {
460 457
         // Did a real whole hour so initialize the hour
461 458
         $itemized[BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = $this->getValue();
462 459
         // We have a whole hour so get rid of the minute info
@@ -497,8 +494,7 @@  discard block
 block discarded – undo
497 494
         // If we are in the same month the end date is the end date of the event
498 495
         if ($this->isSameMonth()) {
499 496
           $dayrange = new \DatePeriod($this->start_date, $dayinterval, new \DateTime($this->end_date->format("Y-n-j 23:59:59")));
500
-        }
501
-        else { // alternatively it is the last day of the start month
497
+        } else { // alternatively it is the last day of the start month
502 498
           $dayrange = new \DatePeriod($this->start_date, $dayinterval, $this->endMonthDate($this->start_date));
503 499
         }
504 500
         foreach ($dayrange as $day) {
Please login to merge, or discard this patch.
src/Calendar/AbstractCalendar.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
       $current_states = array_keys($unit_states);
130 130
       // Compare the current states with the set of valid states
131 131
       $remaining_states = array_diff($current_states, $valid_states);
132
-      if (count($remaining_states) == 0 ) {
132
+      if (count($remaining_states) == 0) {
133 133
         // Unit is in a state that is within the set of valid states so add to result set
134 134
         $units[$unit] = $unit;
135 135
         $response->addMatch($keyed_units[$unit], CalendarResponse::VALID_STATE);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         foreach ($months as $month => $days) {
219 219
           foreach ($days as $day => $hours) {
220 220
             foreach ($hours as $hour => $value) {
221
-              $events[$unit][BAT_HOUR][$year][$month]['d'.$day][$hour] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value);
221
+              $events[$unit][BAT_HOUR][$year][$month]['d' . $day][$hour] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value);
222 222
             }
223 223
           }
224 224
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             foreach ($hours as $hour => $minutes) {
233 233
               foreach ($minutes as $minute => $value) {
234 234
                 if (isset($db_events[$unit][BAT_MINUTE][$year][$month][$day][$hour][$minute])) {
235
-                  $events[$unit][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]);
235
+                  $events[$unit][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]);
236 236
                 }
237 237
                 else {
238 238
                   // If nothing from db - then revert to the defaults
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
           foreach ($days as $day => $hours) {
251 251
             foreach ($hours as $hour => $minutes) {
252 252
               foreach ($minutes as $minute => $value) {
253
-                $events[$unit][BAT_MINUTE][$year][$month]['d'.$day]['h'.$hour][$minute] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value);
253
+                $events[$unit][BAT_MINUTE][$year][$month]['d' . $day]['h' . $hour][$minute] = ((int)$value == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$value);
254 254
               }
255 255
             }
256 256
           }
@@ -325,12 +325,12 @@  discard block
 block discarded – undo
325 325
                       // Value just switched - let us wrap up with current event and start a new one
326 326
                       $normalized_events[$unit][] = new Event($start_event, $end_event, $unit, $current_value);
327 327
                       $start_event = clone($end_event->add(new \DateInterval('PT1M')));
328
-                      $end_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute,1));
328
+                      $end_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute, 1));
329 329
                       $current_value = $minute_value;
330 330
                     }
331 331
                     if ($current_value === NULL) {
332 332
                       // We are down to minutes and haven't created and event yet - do one now
333
-                      $start_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute,1));
333
+                      $start_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . substr($hour, 1) . ':' . substr($minute, 1));
334 334
                       $end_event = clone($start_event);
335 335
                     }
336 336
                     $current_value = $minute_value;
Please login to merge, or discard this patch.
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
         $added = FALSE;
59 59
         watchdog('BAT', t('Event with @id, start date @start_date and end date @end_date was not added.', array('@id' => $event->value, '@start_date' => $event->startDateToString(), '@end_date' => $event->endDateToString())));
60 60
         break;
61
-      }
62
-      else {
61
+      } else {
63 62
         watchdog('BAT', t('Event with @id, start date @start_date and end date @end_date added.', array('@id' => $event->value, '@start_date' => $event->startDateToString(), '@end_date' => $event->endDateToString())));
64 63
       }
65 64
     }
@@ -133,8 +132,7 @@  discard block
 block discarded – undo
133 132
         // Unit is in a state that is within the set of valid states so add to result set
134 133
         $units[$unit] = $unit;
135 134
         $response->addMatch($keyed_units[$unit], CalendarResponse::VALID_STATE);
136
-      }
137
-      else {
135
+      } else {
138 136
         $response->addMiss($keyed_units[$unit], CalendarResponse::INVALID_STATE);
139 137
       }
140 138
 
@@ -184,8 +182,7 @@  discard block
 block discarded – undo
184 182
             foreach ($days as $day => $value) {
185 183
               $events[$unit][BAT_DAY][$year][$month][$day] = ((int)$db_events[$unit][BAT_DAY][$year][$month][$day] == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$db_events[$unit][BAT_DAY][$year][$month][$day]);
186 184
             }
187
-          }
188
-          else {
185
+          } else {
189 186
             foreach ($days as $day => $value) {
190 187
               $events[$unit][BAT_DAY][$year][$month][$day] = $keyed_units[$unit]->getDefaultValue();
191 188
             }
@@ -202,8 +199,7 @@  discard block
 block discarded – undo
202 199
             foreach ($hours as $hour => $value) {
203 200
               if (isset($db_events[$unit][BAT_HOUR][$year][$month][$day][$hour])) {
204 201
                 $events[$unit][BAT_HOUR][$year][$month]['d' . $day][$hour] = ((int)$db_events[$unit][BAT_DAY][$year][$month][$day][$hour] == 0 ? $keyed_units[$unit]->getDefaultValue() : (int)$db_events[$unit][BAT_DAY][$year][$month][$day][$hour]);
205
-              }
206
-              else {
202
+              } else {
207 203
                 // If nothing from db - then revert to the defaults
208 204
                 $events[$unit][BAT_HOUR][$year][$month][$day][$hour] = (int)$keyed_units[$unit]->getDefaultValue();
209 205
               }
@@ -233,8 +229,7 @@  discard block
 block discarded – undo
233 229
               foreach ($minutes as $minute => $value) {
234 230
                 if (isset($db_events[$unit][BAT_MINUTE][$year][$month][$day][$hour][$minute])) {
235 231
                   $events[$unit][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]);
236
-                }
237
-                else {
232
+                } else {
238 233
                   // If nothing from db - then revert to the defaults
239 234
                   $events[$unit][BAT_MINUTE][$year][$month][$day][$hour][$minute] = (int)$keyed_units[$unit]->getDefaultValue();
240 235
                 }
@@ -320,8 +315,7 @@  discard block
 block discarded – undo
320 315
                     if ($current_value === $minute_value) {
321 316
                       // We are still in minutes and going through so add a minute
322 317
                       $end_event->add(new \DateInterval('PT1M'));
323
-                    }
324
-                    elseif (($current_value != $minute_value) && ($current_value !== NULL)) {
318
+                    } elseif (($current_value != $minute_value) && ($current_value !== NULL)) {
325 319
                       // Value just switched - let us wrap up with current event and start a new one
326 320
                       $normalized_events[$unit][] = new Event($start_event, $end_event, $unit, $current_value);
327 321
                       $start_event = clone($end_event->add(new \DateInterval('PT1M')));
@@ -335,12 +329,10 @@  discard block
 block discarded – undo
335 329
                     }
336 330
                     $current_value = $minute_value;
337 331
                   }
338
-                }
339
-                elseif ($current_value === $hour_value) {
332
+                } elseif ($current_value === $hour_value) {
340 333
                   // We are in hours and can add something
341 334
                   $end_event->add(new \DateInterval('PT1H'));
342
-                }
343
-                elseif (($current_value != $hour_value) && ($current_value !== NULL)) {
335
+                } elseif (($current_value != $hour_value) && ($current_value !== NULL)) {
344 336
                   // Value just switched - let us wrap up with current event and start a new one
345 337
                   $normalized_events[$unit][] = new Event($start_event, $end_event, $unit, $current_value);
346 338
                   // Start event becomes the end event with a minute added
@@ -357,12 +349,10 @@  discard block
 block discarded – undo
357 349
                   $current_value = $hour_value;
358 350
                 }
359 351
               }
360
-            }
361
-            elseif ($current_value === $value) {
352
+            } elseif ($current_value === $value) {
362 353
               // We are adding a whole day so the end event gets moved to the end of the day we are adding
363 354
               $end_event = new \DateTime($year . '-' . $month . '-' . substr($day, 1) . ' ' . '23:59');
364
-            }
365
-            elseif (($current_value !== $value) && ($current_value !== NULL)) {
355
+            } elseif (($current_value !== $value) && ($current_value !== NULL)) {
366 356
               // Value just switched - let us wrap up with current event and start a new one
367 357
               $normalized_events[$unit][] = new Event($start_event, $end_event, $unit, $current_value);
368 358
               // Start event becomes the end event with a minute added
@@ -397,8 +387,7 @@  discard block
 block discarded – undo
397 387
           if ($event->endsLater($end_date)) {
398 388
             $event->setEndDate($end_date);
399 389
           }
400
-        }
401
-        else {
390
+        } else {
402 391
           // Event completely not in range so unset it
403 392
           unset($normalized_events[$unit][$key]);
404 393
         }
@@ -432,8 +421,7 @@  discard block
 block discarded – undo
432 421
           $e++;
433 422
           $flipped[$e][$value][$datum] = $datum;
434 423
           $old_value = $value;
435
-        }
436
-        else {
424
+        } else {
437 425
           $flipped[$e][$value][$datum] = $datum;
438 426
         }
439 427
       }
Please login to merge, or discard this patch.
src/Calendar/Calendar.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
  */
16 16
 class Calendar extends AbstractCalendar {
17 17
 
18
-	/**
19
-	 * @param $units
20
-	 * @param $store
21
-	 * @param $default_value
22
-	 */
18
+  /**
19
+   * @param $units
20
+   * @param $store
21
+   * @param $default_value
22
+   */
23 23
   public function __construct($units, $store, $default_value = 0) {
24 24
     $this->units = $units;
25 25
     $this->store = $store;
Please login to merge, or discard this patch.
src/Calendar/CalendarResponse.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,8 +126,7 @@
 block discarded – undo
126 126
       unset($this->included_set[$unit->getUnitId()]);
127 127
       $this->addMiss($unit, $reason, $constraint);
128 128
       return TRUE;
129
-    }
130
-    else {
129
+    } else {
131 130
       return FALSE;
132 131
     }
133 132
   }
Please login to merge, or discard this patch.
src/Constraint/MinMaxConstraint.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
         $text = t('The stay') . ' ';
135 135
       }
136 136
       else {
137
-        $text .=   ' ' . t('the stay') . ' ';
137
+        $text .= ' ' . t('the stay') . ' ';
138 138
       }
139 139
     }
140 140
     if ($minimum_stay && $maximum_stay) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@  discard block
 block discarded – undo
70 70
             $calendar_response->removeFromMatched($included_set[$unit_id]['unit'], CalendarResponse::CONSTRAINT, $this);
71 71
 
72 72
             $this->affected_units[$unit_id] = $included_set[$unit_id]['unit'];
73
-          }
74
-          elseif (is_numeric($this->max_days) && $diff > $this->max_days) {
73
+          } elseif (is_numeric($this->max_days) && $diff > $this->max_days) {
75 74
             $calendar_response->removeFromMatched($included_set[$unit_id]['unit'], CalendarResponse::CONSTRAINT, $this);
76 75
 
77 76
             $this->affected_units[$unit_id] = $included_set[$unit_id]['unit'];
@@ -122,8 +121,7 @@  discard block
 block discarded – undo
122 121
     if ($day_of_the_week) {
123 122
       if ($start_date && $end_date) {
124 123
         $text = t('From @start_date to @end_date, if booking starts on @day_of_the_week', $args);
125
-      }
126
-      else {
124
+      } else {
127 125
         $text = t('If booking starts on @day_of_the_week', $args);
128 126
       }
129 127
     }
@@ -132,8 +130,7 @@  discard block
 block discarded – undo
132 130
     if ($minimum_stay || $maximum_stay) {
133 131
       if (empty($text)) {
134 132
         $text = t('The stay') . ' ';
135
-      }
136
-      else {
133
+      } else {
137 134
         $text .=   ' ' . t('the stay') . ' ';
138 135
       }
139 136
     }
@@ -141,15 +138,12 @@  discard block
 block discarded – undo
141 138
       // Special case when min stay and max stay are the same.
142 139
       if ($minimum_stay == $maximum_stay) {
143 140
         $text .= t('must be for @minimum_stay', $args);
144
-      }
145
-      else {
141
+      } else {
146 142
         $text .= t('must be at least @minimum_stay and at most @maximum_stay', $args);
147 143
       }
148
-    }
149
-    elseif ($minimum_stay) {
144
+    } elseif ($minimum_stay) {
150 145
       $text .= t('must be for at least @minimum_stay', $args);
151
-    }
152
-    elseif ($maximum_stay) {
146
+    } elseif ($maximum_stay) {
153 147
       $text .= t('cannot be more than @maximum_stay', $args);
154 148
     }
155 149
 
Please login to merge, or discard this patch.
src/Store/DrupalDBStore.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
    */
79 79
   public function getEventData(\DateTime $start_date, \DateTime $end_date, $unit_ids) {
80 80
 
81
-    $queries  = $this->buildQueries($start_date, $end_date, $unit_ids);
81
+    $queries = $this->buildQueries($start_date, $end_date, $unit_ids);
82 82
 
83 83
     $results = array();
84 84
     // Run each query and store results
@@ -89,30 +89,30 @@  discard block
 block discarded – undo
89 89
     $db_events = array();
90 90
 
91 91
     // Cycle through day results and setup an event array
92
-    while( $data = $results[Event::BAT_DAY]->fetchAssoc()) {
92
+    while ($data = $results[Event::BAT_DAY]->fetchAssoc()) {
93 93
       // Figure out how many days the current month has
94 94
       $temp_date = new \DateTime($data['year'] . "-" . $data['month']);
95 95
       $days_in_month = (int)$temp_date->format('t');
96
-      for ($i = 1; $i<=$days_in_month; $i++) {
97
-        $db_events[$data['unit_id']][Event::BAT_DAY][$data['year']][$data['month']]['d' . $i] = $data['d'.$i];
96
+      for ($i = 1; $i <= $days_in_month; $i++) {
97
+        $db_events[$data['unit_id']][Event::BAT_DAY][$data['year']][$data['month']]['d' . $i] = $data['d' . $i];
98 98
       }
99 99
     }
100 100
 
101 101
     // With the day events taken care off let's cycle through hours
102
-    while( $data = $results[Event::BAT_HOUR]->fetchAssoc()) {
103
-      for ($i = 0; $i<=23; $i++) {
104
-        $db_events[$data['unit_id']][Event::BAT_HOUR][$data['year']][$data['month']][$data['day']]['h'. $i] = $data['h'.$i];
102
+    while ($data = $results[Event::BAT_HOUR]->fetchAssoc()) {
103
+      for ($i = 0; $i <= 23; $i++) {
104
+        $db_events[$data['unit_id']][Event::BAT_HOUR][$data['year']][$data['month']][$data['day']]['h' . $i] = $data['h' . $i];
105 105
       }
106 106
     }
107 107
 
108 108
     // With the hour events taken care off let's cycle through minutes
109
-    while( $data = $results[Event::BAT_MINUTE]->fetchAssoc()) {
110
-      for ($i = 0; $i<=59; $i++) {
109
+    while ($data = $results[Event::BAT_MINUTE]->fetchAssoc()) {
110
+      for ($i = 0; $i <= 59; $i++) {
111 111
         if ($i <= 9) {
112
-          $index = 'm0'.$i;
112
+          $index = 'm0' . $i;
113 113
         }
114 114
         else {
115
-          $index = 'm'.$i;
115
+          $index = 'm' . $i;
116 116
         }
117 117
         $db_events[$data['unit_id']][Event::BAT_MINUTE][$data['year']][$data['month']][$data['day']][$data['hour']][$index] = $data[$index];
118 118
       }
@@ -230,16 +230,16 @@  discard block
 block discarded – undo
230 230
 
231 231
     $query_parameters = '';
232 232
 
233
-    foreach($itemized[BAT_DAY] as $year => $months) {
233
+    foreach ($itemized[BAT_DAY] as $year => $months) {
234 234
       if ($year_count > 0) {
235 235
         // We are dealing with multiple years so add an OR
236 236
         $query_parameters .= ' OR ';
237 237
       }
238 238
       $query_parameters .= 'year IN (' . $year . ') ';
239
-      $query_parameters .= 'AND month IN (' . implode("," ,array_keys($months)) .') ';
239
+      $query_parameters .= 'AND month IN (' . implode(",", array_keys($months)) . ') ';
240 240
       if (count($unit_ids) > 0) {
241 241
         // Unit ids are defined so add this as a filter
242
-        $query_parameters .= 'AND unit_id in (' . implode("," , $unit_ids) .') ';
242
+        $query_parameters .= 'AND unit_id in (' . implode(",", $unit_ids) . ') ';
243 243
       }
244 244
       $year_count++;
245 245
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
       for ($i = 0; $i<=59; $i++) {
111 111
         if ($i <= 9) {
112 112
           $index = 'm0'.$i;
113
-        }
114
-        else {
113
+        } else {
115 114
           $index = 'm'.$i;
116 115
         }
117 116
         $db_events[$data['unit_id']][Event::BAT_MINUTE][$data['year']][$data['month']][$data['day']][$data['hour']][$index] = $data[$index];
@@ -190,8 +189,7 @@  discard block
 block discarded – undo
190 189
           }
191 190
         }
192 191
       }
193
-    }
194
-    catch (\Exception $e) {
192
+    } catch (\Exception $e) {
195 193
       $saved = FALSE;
196 194
       $transaction->rollback();
197 195
       watchdog_exception('BAT Event Save Exception', $e);
Please login to merge, or discard this patch.