@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | protected function normalizeMinMaxDaysConstraints() { |
97 | 97 | $new_constraints = array(); |
98 | 98 | |
99 | - $constraints = array_map(function ($object) { return clone $object; }, $this->constraints['Roomify\Bat\Constraint\MinMaxDaysConstraint']); |
|
99 | + $constraints = array_map(function($object) { return clone $object; }, $this->constraints['Roomify\Bat\Constraint\MinMaxDaysConstraint']); |
|
100 | 100 | |
101 | 101 | foreach (array_reverse($constraints) as $constraint) { |
102 | 102 | $start_date = $constraint->getStartDate(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | protected function normalizeCheckInDayConstraints() { |
173 | 173 | $new_constraints = array(); |
174 | 174 | |
175 | - $constraints = array_map(function ($object) { return clone $object; }, $this->constraints['Roomify\Bat\Constraint\CheckInDayConstraint']); |
|
175 | + $constraints = array_map(function($object) { return clone $object; }, $this->constraints['Roomify\Bat\Constraint\CheckInDayConstraint']); |
|
176 | 176 | |
177 | 177 | foreach (array_reverse($constraints) as $constraint) { |
178 | 178 | $start_date = $constraint->getStartDate(); |
@@ -115,12 +115,10 @@ discard block |
||
115 | 115 | if ($start_date >= $new_start_date && $start_date <= $new_end_date) { |
116 | 116 | $new_end_date_clone = clone($new_end_date); |
117 | 117 | $constraint->setStartDate($new_end_date_clone->add(new \DateInterval('P1D'))); |
118 | - } |
|
119 | - elseif ($end_date >= $new_start_date && $end_date <= $new_end_date) { |
|
118 | + } elseif ($end_date >= $new_start_date && $end_date <= $new_end_date) { |
|
120 | 119 | $new_start_date_clone = clone($new_start_date); |
121 | 120 | $constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D'))); |
122 | - } |
|
123 | - elseif ($start_date < $new_start_date && $end_date > $new_end_date) { |
|
121 | + } elseif ($start_date < $new_start_date && $end_date > $new_end_date) { |
|
124 | 122 | if ($constraint->getEndDate() > $new_start_date) { |
125 | 123 | $new_start_date_clone = clone($new_start_date); |
126 | 124 | $constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D'))); |
@@ -132,8 +130,7 @@ discard block |
||
132 | 130 | $split_end_date = $end_date; |
133 | 131 | |
134 | 132 | $split_constraint = new MinMaxDaysConstraint($constraint->getUnits(), $constraint->getMinDays(), $constraint->getMaxDays(), $split_start_date, $split_end_date, $constraint->getCheckinDay()); |
135 | - } |
|
136 | - else { |
|
133 | + } else { |
|
137 | 134 | $split_start_date = $split_constraint->getStartDate(); |
138 | 135 | $split_end_date = $split_constraint->getEndDate(); |
139 | 136 |
@@ -77,23 +77,23 @@ discard block |
||
77 | 77 | $this->event_type = $event_type; |
78 | 78 | |
79 | 79 | if ($event_data == SqlDBStore::BAT_STATE) { |
80 | - $this->day_table = $prefix . 'bat_event_' . $event_type . '_day_' . SqlDBStore::BAT_STATE; |
|
81 | - $this->hour_table = $prefix . 'bat_event_' . $event_type . '_hour_' . SqlDBStore::BAT_STATE; |
|
82 | - $this->minute_table = $prefix . 'bat_event_' . $event_type . '_minute_' . SqlDBStore::BAT_STATE; |
|
80 | + $this->day_table = $prefix.'bat_event_'.$event_type.'_day_'.SqlDBStore::BAT_STATE; |
|
81 | + $this->hour_table = $prefix.'bat_event_'.$event_type.'_hour_'.SqlDBStore::BAT_STATE; |
|
82 | + $this->minute_table = $prefix.'bat_event_'.$event_type.'_minute_'.SqlDBStore::BAT_STATE; |
|
83 | 83 | |
84 | - $this->day_table_no_prefix = 'bat_event_' . $event_type . '_day_' . SqlDBStore::BAT_STATE; |
|
85 | - $this->hour_table_no_prefix = 'bat_event_' . $event_type . '_hour_' . SqlDBStore::BAT_STATE; |
|
86 | - $this->minute_table_no_prefix = 'bat_event_' . $event_type . '_minute_' . SqlDBStore::BAT_STATE; |
|
84 | + $this->day_table_no_prefix = 'bat_event_'.$event_type.'_day_'.SqlDBStore::BAT_STATE; |
|
85 | + $this->hour_table_no_prefix = 'bat_event_'.$event_type.'_hour_'.SqlDBStore::BAT_STATE; |
|
86 | + $this->minute_table_no_prefix = 'bat_event_'.$event_type.'_minute_'.SqlDBStore::BAT_STATE; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | if ($event_data == SqlDBStore::BAT_EVENT) { |
90 | - $this->day_table = $prefix . 'bat_event_' . $event_type . '_day_' . SqlDBStore::BAT_EVENT; |
|
91 | - $this->hour_table = $prefix . 'bat_event_' . $event_type . '_hour_' . SqlDBStore::BAT_EVENT; |
|
92 | - $this->minute_table = $prefix . 'bat_event_' . $event_type . '_minute_' . SqlDBStore::BAT_EVENT; |
|
90 | + $this->day_table = $prefix.'bat_event_'.$event_type.'_day_'.SqlDBStore::BAT_EVENT; |
|
91 | + $this->hour_table = $prefix.'bat_event_'.$event_type.'_hour_'.SqlDBStore::BAT_EVENT; |
|
92 | + $this->minute_table = $prefix.'bat_event_'.$event_type.'_minute_'.SqlDBStore::BAT_EVENT; |
|
93 | 93 | |
94 | - $this->day_table_no_prefix = 'bat_event_' . $event_type . '_day_' . SqlDBStore::BAT_EVENT; |
|
95 | - $this->hour_table_no_prefix = 'bat_event_' . $event_type . '_hour_' . SqlDBStore::BAT_EVENT; |
|
96 | - $this->minute_table_no_prefix = 'bat_event_' . $event_type . '_minute_' . SqlDBStore::BAT_EVENT; |
|
94 | + $this->day_table_no_prefix = 'bat_event_'.$event_type.'_day_'.SqlDBStore::BAT_EVENT; |
|
95 | + $this->hour_table_no_prefix = 'bat_event_'.$event_type.'_hour_'.SqlDBStore::BAT_EVENT; |
|
96 | + $this->minute_table_no_prefix = 'bat_event_'.$event_type.'_minute_'.SqlDBStore::BAT_EVENT; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | } |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | public function buildQueries(\DateTime $start_date, \DateTime $end_date, $unit_ids) { |
109 | 109 | $queries = array(); |
110 | 110 | |
111 | - $queries[Event::BAT_DAY] = 'SELECT * FROM ' . $this->day_table . ' WHERE '; |
|
112 | - $queries[Event::BAT_HOUR] = 'SELECT * FROM ' . $this->hour_table . ' WHERE '; |
|
113 | - $queries[Event::BAT_MINUTE] = 'SELECT * FROM ' . $this->minute_table . ' WHERE '; |
|
111 | + $queries[Event::BAT_DAY] = 'SELECT * FROM '.$this->day_table.' WHERE '; |
|
112 | + $queries[Event::BAT_HOUR] = 'SELECT * FROM '.$this->hour_table.' WHERE '; |
|
113 | + $queries[Event::BAT_MINUTE] = 'SELECT * FROM '.$this->minute_table.' WHERE '; |
|
114 | 114 | |
115 | 115 | // Create a mock event which we will use to determine how to query the database |
116 | 116 | $mock_event = new Event($start_date, $end_date, new Unit(0, 0, NULL), -10); |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | // We are dealing with multiple years so add an OR |
129 | 129 | $query_parameters .= ' OR '; |
130 | 130 | } |
131 | - $query_parameters .= 'year IN (' . $year . ') '; |
|
132 | - $query_parameters .= 'AND month IN (' . implode(",", array_keys($months)) . ') '; |
|
131 | + $query_parameters .= 'year IN ('.$year.') '; |
|
132 | + $query_parameters .= 'AND month IN ('.implode(",", array_keys($months)).') '; |
|
133 | 133 | if (count($unit_ids) > 0) { |
134 | 134 | // Unit ids are defined so add this as a filter |
135 | - $query_parameters .= 'AND unit_id in (' . implode("," , $unit_ids) . ') '; |
|
135 | + $query_parameters .= 'AND unit_id in ('.implode(",", $unit_ids).') '; |
|
136 | 136 | } |
137 | 137 | $year_count++; |
138 | 138 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | /** |
53 | 53 | * {@inheritdoc} |
54 | 54 | */ |
55 | - public function applyConstraint(CalendarResponse &$calendar_response) { |
|
55 | + public function applyConstraint(CalendarResponse & $calendar_response) { |
|
56 | 56 | parent::applyConstraint($calendar_response); |
57 | 57 | |
58 | 58 | if ($this->start_date === NULL) { |