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