@@ -68,7 +68,7 @@ |
||
| 68 | 68 | */ |
| 69 | 69 | public function getImageLocationStats(): array |
| 70 | 70 | { |
| 71 | - return $this->cache->get('image_location_stats', function (ItemInterface $item) { |
|
| 71 | + return $this->cache->get('image_location_stats', function(ItemInterface $item) { |
|
| 72 | 72 | $item->tag('stats'); |
| 73 | 73 | $stats = $this->imageRepository |
| 74 | 74 | ->createQueryBuilder('i') |
@@ -85,8 +85,7 @@ |
||
| 85 | 85 | $wander->setMaxAltitude($stats->maxAltitude); |
| 86 | 86 | $wander->setMinAltitude($stats->minAltitude); |
| 87 | 87 | $wander->setCumulativeElevationGain($stats->cumulativeElevationGain); |
| 88 | - } |
|
| 89 | - catch (Exception $e) { |
|
| 88 | + } catch (Exception $e) { |
|
| 90 | 89 | //$this->logger->debug("Couldn't set extended GPX property on wander: " . $e->getMessage()); |
| 91 | 90 | throw new Exception("Couldn't set standard GPX stats properties on wander.", 0, $e); |
| 92 | 91 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | // It's nicer for our JavaScript to be handed the Wander URI on a plate, so we add it |
| 47 | 47 | // to the returned JSON. |
| 48 | - $contentUrlCallback = function ( |
|
| 48 | + $contentUrlCallback = function( |
|
| 49 | 49 | /** @scrutinizer ignore-unused */ $innerObject, |
| 50 | 50 | $outerObject, |
| 51 | 51 | /** @scrutinizer ignore-unused */ string $attributeName, |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ): Response { |
| 94 | 94 | // It's nicer for our JavaScript to be handed the Wander URI on a plate, so we add it |
| 95 | 95 | // to the returned JSON. |
| 96 | - $contentUrlCallback = function ( |
|
| 96 | + $contentUrlCallback = function( |
|
| 97 | 97 | /** @scrutinizer ignore-unused */ $innerObject, |
| 98 | 98 | $outerObject, |
| 99 | 99 | /** @scrutinizer ignore-unused */ string $attributeName, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $token = (string) $request->request->get('token'); |
| 83 | 83 | if (!$this->isCsrfTokenValid('image_upload', $token)) { |
| 84 | - return $this->json([ 'error' => 'Invalid CSRF token'], 401); |
|
| 84 | + return $this->json(['error' => 'Invalid CSRF token'], 401); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $file = $request->files->get('file'); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | Image $image, |
| 159 | 159 | ManagerRegistry $managerRegistry |
| 160 | 160 | ): Response { |
| 161 | - if ($this->isCsrfTokenValid('delete'.$image->getId(), (string) $request->request->get('_token'))) { |
|
| 161 | + if ($this->isCsrfTokenValid('delete' . $image->getId(), (string) $request->request->get('_token'))) { |
|
| 162 | 162 | $entityManager = $managerRegistry->getManager(); |
| 163 | 163 | $entityManager->remove($image); |
| 164 | 164 | $entityManager->flush(); |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function setLocation(Request $request, Image $image, LocationService $locationService, EntityManagerInterface $entityManager): Response |
| 174 | 174 | { |
| 175 | - if ($this->isCsrfTokenValid('set_location'.$image->getId(), (string) $request->request->get('_token'))) { |
|
| 176 | - $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
| 175 | + if ($this->isCsrfTokenValid('set_location' . $image->getId(), (string) $request->request->get('_token'))) { |
|
| 176 | + $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
| 177 | 177 | if ($neighbourhood !== null) { |
| 178 | 178 | $image->setLocation($neighbourhood); |
| 179 | 179 | $entityManager->persist($image); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function setAutoTags(Request $request, Image $image, MessageBusInterface $messageBus): Response |
| 191 | 191 | { |
| 192 | - if ($this->isCsrfTokenValid('set_auto_tags'.$image->getId(), (string) $request->request->get('_token'))) { |
|
| 192 | + if ($this->isCsrfTokenValid('set_auto_tags' . $image->getId(), (string) $request->request->get('_token'))) { |
|
| 193 | 193 | $imageId = $image->getId(); |
| 194 | 194 | if ($imageId === null) { |
| 195 | 195 | throw new InvalidParameterException('No image id in setAutoTags'); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | { |
| 62 | 62 | $qb = $this->createQueryBuilder($entityAlias); |
| 63 | 63 | $qb->select($entityAlias, 'i') |
| 64 | - ->leftJoin($entityAlias.'.images', 'i'); |
|
| 64 | + ->leftJoin($entityAlias . '.images', 'i'); |
|
| 65 | 65 | return $qb; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | 'data' => array_map($series['extractFunction'], $sourceStats), |
| 167 | 167 | ]; |
| 168 | 168 | if (array_key_exists('rating', $series)) { |
| 169 | - $data['urls'][] = array_map(function ($dp) use ($series): string { |
|
| 169 | + $data['urls'][] = array_map(function($dp) use ($series): string { |
|
| 170 | 170 | $params = [ |
| 171 | 171 | 'rating' => $series['rating'], |
| 172 | 172 | 'periodStartDate' => $dp['periodStartDate'], |
@@ -206,7 +206,7 @@ |
||
| 206 | 206 | $result = null; |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | - catch(Exception $e) { |
|
| 209 | + catch (Exception $e) { |
|
| 210 | 210 | // I don't care what happened personally; we'll just not bother |
| 211 | 211 | // overriding our existing dates. However, whatever called us |
| 212 | 212 | // might want to log this, as someone may be probing the app for |
@@ -205,8 +205,7 @@ |
||
| 205 | 205 | // Improbable dates could cause problems if used in DB queries. |
| 206 | 206 | $result = null; |
| 207 | 207 | } |
| 208 | - } |
|
| 209 | - catch(Exception $e) { |
|
| 208 | + } catch(Exception $e) { |
|
| 210 | 209 | // I don't care what happened personally; we'll just not bother |
| 211 | 210 | // overriding our existing dates. However, whatever called us |
| 212 | 211 | // might want to log this, as someone may be probing the app for |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | $filterData->overrideRatingFromUrlParam($request->query->getInt('rating', -1)); |
| 67 | 67 | $filterData->overrideStartDateFromUrlParam((string) $request->query->get('periodStartDate')); |
| 68 | 68 | $filterData->overrideEndDateFromUrlParam((string) $request->query->get('periodEndDate')); |
| 69 | - } |
|
| 70 | - catch (Exception $e) { |
|
| 69 | + } catch (Exception $e) { |
|
| 71 | 70 | // Someone may be trying to fiddle with our URL parameters. Don't fail; the override |
| 72 | 71 | // functions are sensible enough to ignore invalid inputs. But we should log. |
| 73 | 72 | $logger->error( |