@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if ($cfp->getDateCfpStart()->getTimestamp() < 10000) { |
71 | 71 | $cfp->setDateCfpStart(new \DateTimeImmutable()); |
72 | 72 | } |
73 | - $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) ' . |
|
73 | + $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) '. |
|
74 | 74 | 'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);'; |
75 | 75 | $statement = $this->pdo->prepare($statement); |
76 | 76 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function update(Cfp $cfp, $fetchHash) |
104 | 104 | { |
105 | - if (! $fetchHash) { |
|
105 | + if (!$fetchHash) { |
|
106 | 106 | throw new \UnexpectedValueException('No Hash given', 400); |
107 | 107 | } |
108 | 108 | $oldValues = $this->select($fetchHash); |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | ]; |
133 | 133 | |
134 | 134 | foreach ($options as $option) { |
135 | - $method = 'get' . $option; |
|
135 | + $method = 'get'.$option; |
|
136 | 136 | // Merge values from tags and source before comparing! |
137 | 137 | if (in_array($option, ['tags', 'source'])) { |
138 | - $setter = 'set' . $option; |
|
138 | + $setter = 'set'.$option; |
|
139 | 139 | $cfp->$setter(array_merge($oldValues->$method(), $cfp->$method())); |
140 | 140 | } |
141 | 141 | if ($cfp->$method() !== $oldValues->$method()) { |
142 | 142 | if ($option == 'dateCfpStart' && $cfp->$method()->getTimestamp() < 100000) { |
143 | 143 | continue; |
144 | 144 | } |
145 | - $statementElements[] = '`' . $option . '` = :' . $option; |
|
145 | + $statementElements[] = '`'.$option.'` = :'.$option; |
|
146 | 146 | $values[$option] = $cfp->$method(); |
147 | 147 | if ($values[$option] instanceof \DateTimeInterface) { |
148 | 148 | $values[$option] = $values[$option]->format('c'); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | $statement = 'UPDATE `cfp` SET ' |
165 | - . implode(',', $statementElements) . ',' |
|
165 | + . implode(',', $statementElements).',' |
|
166 | 166 | . '`lastUpdate` = :lastUpdate ' |
167 | 167 | . 'WHERE `hash` = :fetchHash'; |
168 | 168 | $statement = $this->pdo->prepare($statement); |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | $values = []; |
299 | 299 | $where = []; |
300 | 300 | foreach ($parameters as $key => $value) { |
301 | - if (! in_array($key, $fields)) { |
|
301 | + if (!in_array($key, $fields)) { |
|
302 | 302 | continue; |
303 | 303 | } |
304 | - if (! is_array($value)) { |
|
304 | + if (!is_array($value)) { |
|
305 | 305 | $value = [$value]; |
306 | 306 | } |
307 | 307 | foreach ($value as $itemkey => $item) { |
@@ -312,22 +312,22 @@ discard block |
||
312 | 312 | 'date_event_end', |
313 | 313 | 'date_event_start' |
314 | 314 | ])) { |
315 | - if (array_key_exists($key . '_compare', $parameters) && isset($parameters[$key . '_compare'][$itemkey]) && in_array($parameters[$key . '_compare'][$itemkey], ['=', '<', '>', '<>'])) { |
|
316 | - $compare = $parameters[$key . '_compare'][$itemkey]; |
|
315 | + if (array_key_exists($key.'_compare', $parameters) && isset($parameters[$key.'_compare'][$itemkey]) && in_array($parameters[$key.'_compare'][$itemkey], ['=', '<', '>', '<>'])) { |
|
316 | + $compare = $parameters[$key.'_compare'][$itemkey]; |
|
317 | 317 | } |
318 | - $where[] = $this->timezoneHelper->getUtcDateTime($transformer->transform($key)) . ' ' . $compare . ' :' . $key . '_' . $itemkey; |
|
318 | + $where[] = $this->timezoneHelper->getUtcDateTime($transformer->transform($key)).' '.$compare.' :'.$key.'_'.$itemkey; |
|
319 | 319 | $value = (new DateTime($item))->setTimezone(new \DateTimeZone('UTC'))->format('c'); |
320 | 320 | } else { |
321 | - $where[] = '`' . $transformer->transform($key) . '` ' . $compare . ' :' . $key; |
|
321 | + $where[] = '`'.$transformer->transform($key).'` '.$compare.' :'.$key; |
|
322 | 322 | } |
323 | - $values[$key . '_' . $itemkey] = $value; |
|
323 | + $values[$key.'_'.$itemkey] = $value; |
|
324 | 324 | } |
325 | 325 | } |
326 | - if (! $where) { |
|
326 | + if (!$where) { |
|
327 | 327 | throw new \UnexpectedValueException('No CFPs found', 404); |
328 | 328 | } |
329 | 329 | |
330 | - $statement .= implode(' AND ', $where) . ' ORDER BY dateCfpEnd ASC'; |
|
330 | + $statement .= implode(' AND ', $where).' ORDER BY dateCfpEnd ASC'; |
|
331 | 331 | |
332 | 332 | $statement = $this->pdo->prepare($statement); |
333 | 333 |