@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $missingFields = []; |
| 50 | 50 | |
| 51 | 51 | foreach ($requiredFields as $field) { |
| 52 | - if (! isset($params[$field])) { |
|
| 52 | + if (!isset($params[$field])) { |
|
| 53 | 53 | $missingFields[] = $field; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | public static function setName(Cfp $cfp, array $array) |
| 84 | 84 | { |
| 85 | - if (! isset($array['name'])) { |
|
| 85 | + if (!isset($array['name'])) { |
|
| 86 | 86 | throw new \InvalidArgumentException('Name has to be specified'); |
| 87 | 87 | } |
| 88 | 88 | $cfp->setName(filter_var($array['name'], FILTER_SANITIZE_STRING)); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public static function setDateCfpStart(Cfp $cfp, array $array) |
| 92 | 92 | { |
| 93 | - if (! isset($array['dateCfpStart'])) { |
|
| 93 | + if (!isset($array['dateCfpStart'])) { |
|
| 94 | 94 | throw new \InvalidArgumentException('CFP-StartDate has to be specified'); |
| 95 | 95 | } |
| 96 | 96 | $cfp->setDateCfpStart(new DateTimeImmutable($array['dateCfpStart'])); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public static function setDateCfpEnd(Cfp $cfp, array $array) |
| 100 | 100 | { |
| 101 | - if (! isset($array['dateCfpEnd'])) { |
|
| 101 | + if (!isset($array['dateCfpEnd'])) { |
|
| 102 | 102 | throw new \InvalidArgumentException('CFP-EndDate has to be specified'); |
| 103 | 103 | } |
| 104 | 104 | $cfp->setDateCfpEnd(new DateTimeImmutable($array['dateCfpEnd'])); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public static function setTimezone(Cfp $cfp, array $array) |
| 108 | 108 | { |
| 109 | - if (! isset($array['timezone'])) { |
|
| 109 | + if (!isset($array['timezone'])) { |
|
| 110 | 110 | throw new \InvalidArgumentException('Timezone has to be specified'); |
| 111 | 111 | } |
| 112 | 112 | $cfp->setTimezone(filter_var($array['timezone'], FILTER_SANITIZE_STRING)); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | public static function setUri(Cfp $cfp, array $array) |
| 116 | 116 | { |
| 117 | - if (! isset($array['uri'])) { |
|
| 117 | + if (!isset($array['uri'])) { |
|
| 118 | 118 | throw new \InvalidArgumentException('URI has to be specified'); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | public static function setEventUri(Cfp $cfp, array $array) |
| 125 | 125 | { |
| 126 | - if (! isset($array['eventUri'])) { |
|
| 126 | + if (!isset($array['eventUri'])) { |
|
| 127 | 127 | throw new \InvalidArgumentException('Event-URI has to be specified'); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | public static function setIconUri(Cfp $cfp, array $array) |
| 152 | 152 | { |
| 153 | - if (! isset($array['iconUri'])) { |
|
| 153 | + if (!isset($array['iconUri'])) { |
|
| 154 | 154 | return; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | public static function setDescription(Cfp $cfp, array $array) |
| 161 | 161 | { |
| 162 | - if (! isset($array['description'])) { |
|
| 162 | + if (!isset($array['description'])) { |
|
| 163 | 163 | return; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | public static function setLocation(Cfp $cfp, array $array) |
| 170 | 170 | { |
| 171 | - if (! isset($array['location'])) { |
|
| 171 | + if (!isset($array['location'])) { |
|
| 172 | 172 | return; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | public static function setGeolocation(Cfp $cfp, array $array) |
| 179 | 179 | { |
| 180 | - if (! isset($array['latitude'])) { |
|
| 180 | + if (!isset($array['latitude'])) { |
|
| 181 | 181 | return; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if (! isset($array['longitude'])) { |
|
| 184 | + if (!isset($array['longitude'])) { |
|
| 185 | 185 | return; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -214,18 +214,18 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | public static function setTags(Cfp $cfp, array $array) |
| 216 | 216 | { |
| 217 | - if (! isset($array['tags'])) { |
|
| 217 | + if (!isset($array['tags'])) { |
|
| 218 | 218 | return; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $cfp->setTags(array_map(function ($item) { |
|
| 221 | + $cfp->setTags(array_map(function($item) { |
|
| 222 | 222 | return filter_var($item, FILTER_SANITIZE_STRING); |
| 223 | 223 | }, $array['tags'])); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | public static function setSource(Cfp $cfp, array $array) |
| 227 | 227 | { |
| 228 | - if (! isset($array['source'])) { |
|
| 228 | + if (!isset($array['source'])) { |
|
| 229 | 229 | return; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $cfp->getEventUri() |
| 55 | 55 | ), 400); |
| 56 | 56 | } |
| 57 | - $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) ' . |
|
| 57 | + $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) '. |
|
| 58 | 58 | 'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);'; |
| 59 | 59 | $statement = $this->pdo->prepare($statement); |
| 60 | 60 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function update(Cfp $cfp, $fetchHash) |
| 89 | 89 | { |
| 90 | - if (! $fetchHash) { |
|
| 90 | + if (!$fetchHash) { |
|
| 91 | 91 | throw new \UnexpectedValueException('No Hash given', 400); |
| 92 | 92 | } |
| 93 | 93 | $oldValues = $this->select($fetchHash); |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | ]; |
| 118 | 118 | |
| 119 | 119 | foreach ($options as $option) { |
| 120 | - $method = 'get' . $option; |
|
| 120 | + $method = 'get'.$option; |
|
| 121 | 121 | // Merge values from tags and source before comparing! |
| 122 | 122 | if (in_array($option, ['tags', 'source'])) { |
| 123 | - $setter = 'set' . $option; |
|
| 123 | + $setter = 'set'.$option; |
|
| 124 | 124 | $cfp->$setter(array_merge($oldValues->$method(), $cfp->$method())); |
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | if ($cfp->$method() != $oldValues->$method()) { |
| 128 | - $statementElements[] = '`' . $option . '` = :' . $option; |
|
| 128 | + $statementElements[] = '`'.$option.'` = :'.$option; |
|
| 129 | 129 | $values[$option] = $cfp->$method(); |
| 130 | 130 | if ($values[$option] instanceof \DateTimeInterface) { |
| 131 | 131 | $values[$option] = $values[$option]->format('c'); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $statement = 'UPDATE `cfp` SET ' |
| 145 | - . implode(',', $statementElements) . ',' |
|
| 145 | + . implode(',', $statementElements).',' |
|
| 146 | 146 | . '`lastUpdate` = :lastUpdate ' |
| 147 | 147 | . 'WHERE `hash` = :fetchHash'; |
| 148 | 148 | $statement = $this->pdo->prepare($statement); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | public function setTimezone($timezone) |
| 248 | 248 | { |
| 249 | - if (! $timezone instanceof \DateTimeZone) { |
|
| 249 | + if (!$timezone instanceof \DateTimeZone) { |
|
| 250 | 250 | $timezone = new \DateTimeZone($timezone); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | public function addSource($source) |
| 297 | 297 | { |
| 298 | - if (! in_array($source)) { |
|
| 298 | + if (!in_array($source)) { |
|
| 299 | 299 | $this->source[] = $source; |
| 300 | 300 | } |
| 301 | 301 | } |