@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $this->exif = $exif; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function getTitle():?string |
|
| 23 | + public function getTitle(): ?string |
|
| 24 | 24 | { |
| 25 | 25 | $title = $this->exif->getTitle(); |
| 26 | 26 | if ($title === false) { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | // JSON.) |
| 35 | 35 | return (string) $title; |
| 36 | 36 | } |
| 37 | - public function getDescription():?string |
|
| 37 | + public function getDescription(): ?string |
|
| 38 | 38 | { |
| 39 | 39 | $description = $this->exif->getCaption(); |
| 40 | 40 | if ($description === false) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | return (string) $description; |
| 44 | 44 | } |
| 45 | - public function getGPS():?array |
|
| 45 | + public function getGPS(): ?array |
|
| 46 | 46 | { |
| 47 | 47 | $gps = []; // Match the default in our Image entity |
| 48 | 48 | $gps_as_string = $this->exif->getGPS(); |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | return $gps; |
| 53 | 53 | } |
| 54 | - public function getKeywords():?array |
|
| 54 | + public function getKeywords(): ?array |
|
| 55 | 55 | { |
| 56 | 56 | $keywords = $this->exif->getKeywords(); |
| 57 | 57 | if (is_string($keywords)) { |
| 58 | 58 | // A single keyword comes back as a simple string, not an array. We |
| 59 | 59 | // always return an array. |
| 60 | - $keywords = [ $keywords ]; |
|
| 60 | + $keywords = [$keywords]; |
|
| 61 | 61 | } |
| 62 | 62 | if (is_array($keywords)) { |
| 63 | 63 | return $keywords; |
| 64 | 64 | } |
| 65 | 65 | return []; // Match the default in our Image entity |
| 66 | 66 | } |
| 67 | - public function getCreationDate():?\DateTime |
|
| 67 | + public function getCreationDate(): ?\DateTime |
|
| 68 | 68 | { |
| 69 | 69 | $creationDate = $this->exif->getCreationDate(); |
| 70 | 70 | if ($creationDate instanceof \DateTime) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | return null; |
| 80 | 80 | } |
| 81 | - public function getRating():?int |
|
| 81 | + public function getRating(): ?int |
|
| 82 | 82 | { |
| 83 | 83 | $raw = $this->exif->getRawData(); |
| 84 | 84 | if (array_key_exists('XMP-xmp:Rating', $raw)) { |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @param WarmImageCache $message |
| 26 | - */ |
|
| 26 | + */ |
|
| 27 | 27 | public function __invoke(WarmImageCache $message): void |
| 28 | 28 | { |
| 29 | 29 | $path = $message->getPath(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $token = $request->request->get('token'); |
| 81 | 81 | if (!$this->isCsrfTokenValid('image_upload', $token)) { |
| 82 | - return $this->json([ 'error' => 'Invalid CSRF token'], 401); |
|
| 82 | + return $this->json(['error' => 'Invalid CSRF token'], 401); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $file = $request->files->get('file'); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // file we just uploaded*, thanks to the IGNORED_ATTRIBUTES. Because we set up the |
| 102 | 102 | // image URIs in a postPersist event listener, this also contains everything you'd |
| 103 | 103 | // need to build an image in HTML. |
| 104 | - return new JsonResponse($serializer->serialize($image, 'jsonld', [AbstractNormalizer::IGNORED_ATTRIBUTES => ['imageFile']]), 201,[], true); |
|
| 104 | + return new JsonResponse($serializer->serialize($image, 'jsonld', [AbstractNormalizer::IGNORED_ATTRIBUTES => ['imageFile']]), 201, [], true); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Normal GET request. |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function delete(Request $request, Image $image): Response |
| 151 | 151 | { |
| 152 | - if ($this->isCsrfTokenValid('delete'.$image->getId(), $request->request->get('_token'))) { |
|
| 152 | + if ($this->isCsrfTokenValid('delete' . $image->getId(), $request->request->get('_token'))) { |
|
| 153 | 153 | $entityManager = $this->getDoctrine()->getManager(); |
| 154 | 154 | $entityManager->remove($image); |
| 155 | 155 | $entityManager->flush(); |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function setLocation(Request $request, Image $image, LocationService $locationService, EntityManagerInterface $entityManager): Response |
| 165 | 165 | { |
| 166 | - if ($this->isCsrfTokenValid('set_location'.$image->getId(), $request->request->get('_token'))) { |
|
| 167 | - $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
| 166 | + if ($this->isCsrfTokenValid('set_location' . $image->getId(), $request->request->get('_token'))) { |
|
| 167 | + $neighbourhood = $locationService->getLocationName($image->getLatitude(), $image->getLongitude()); |
|
| 168 | 168 | if ($neighbourhood !== null) { |
| 169 | 169 | $image->setLocation($neighbourhood); |
| 170 | 170 | $entityManager->persist($image); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function setAutoTags(Request $request, Image $image, MessageBusInterface $messageBus): Response |
| 182 | 182 | { |
| 183 | - if ($this->isCsrfTokenValid('set_auto_tags'.$image->getId(), $request->request->get('_token'))) { |
|
| 183 | + if ($this->isCsrfTokenValid('set_auto_tags' . $image->getId(), $request->request->get('_token'))) { |
|
| 184 | 184 | $imageId = $image->getId(); |
| 185 | 185 | if ($imageId === null) { |
| 186 | 186 | throw new InvalidParameterException('No image id in setAutoTags'); |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | $this->gpxDirectory, |
| 41 | 41 | $newFilename |
| 42 | 42 | ); |
| 43 | - } |
|
| 44 | - catch (FileException $e) { |
|
| 43 | + } catch (FileException $e) { |
|
| 45 | 44 | throw new HttpException(500, "Failed finishing GPX upload: " . $e->getMessage()); |
| 46 | 45 | } |
| 47 | 46 | return $newFilename; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | { |
| 36 | 36 | $fs = new Filesystem(); |
| 37 | 37 | $finder = new Finder(); |
| 38 | - foreach($finder->in(__DIR__ . '/gpx')->name('/\.gpx$/i') as $source) { |
|
| 38 | + foreach ($finder->in(__DIR__ . '/gpx')->name('/\.gpx$/i') as $source) { |
|
| 39 | 39 | $targetPath = sys_get_temp_dir() . '/' . $source->getFilename(); |
| 40 | 40 | $fs->copy($source->getPathname(), $targetPath); |
| 41 | 41 | $uploadedFile = $this->uploadHelper->uploadGpxFile(new File($targetPath)); |
@@ -21,8 +21,9 @@ |
||
| 21 | 21 | |
| 22 | 22 | public function durationToHMS(?DateInterval $interval): string |
| 23 | 23 | { |
| 24 | - if (!isset($interval)) |
|
| 25 | - return ""; |
|
| 24 | + if (!isset($interval)) { |
|
| 25 | + return ""; |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | return $interval->format('%hh %im %ss'); |
| 28 | 29 | } |
@@ -451,7 +451,7 @@ |
||
| 451 | 451 | 13 => 'NW', |
| 452 | 452 | 14 => 'NW', |
| 453 | 453 | 15 => 'N' |
| 454 | - ]; |
|
| 454 | + ]; |
|
| 455 | 455 | |
| 456 | 456 | /** |
| 457 | 457 | * @ORM\Column(type="text", nullable=true) |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | public function createSearchQueryBuilder(string $entityAlias): QueryBuilder { |
| 50 | 50 | $qb = $this->createQueryBuilder($entityAlias); |
| 51 | 51 | $qb->select($entityAlias, 'i') |
| 52 | - ->leftJoin($entityAlias.'.images', 'i'); |
|
| 52 | + ->leftJoin($entityAlias . '.images', 'i'); |
|
| 53 | 53 | return $qb; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $fs = new Filesystem(); |
| 38 | 38 | $source = __DIR__ . '/gpx/01-APR-21 125735.GPX'; |
| 39 | - $targetPath = sys_get_temp_dir() . '/01-APR-21 125735.GPX'; |
|
| 39 | + $targetPath = sys_get_temp_dir() . '/01-APR-21 125735.GPX'; |
|
| 40 | 40 | $fs->copy($source, $targetPath); |
| 41 | 41 | $uploadedFile = $this->uploadHelper->uploadGpxFile(new File($targetPath)); |
| 42 | 42 | $wander = new Wander(); |