Passed
Push — master ( eb6568...048cf4 )
by Matt
04:32
created
src/MessageHandler/WarmImageCacheHandler.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Controller/Admin/ImageController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Service/UploadHelper.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/DataFixtures/WanderFixtures.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/Twig/GeneralRuntime.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Repository/WanderRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/DataFixtures/SingleWanderFixture.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/DataFixtures/ThreeWanderFixtures.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     {
36 36
         $fs = new Filesystem();
37 37
         $finder = new Finder();
38
-        foreach($finder->in(__DIR__ . '/gpx/three')->name('/\.gpx$/i') as $source) {
38
+        foreach ($finder->in(__DIR__ . '/gpx/three')->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));
Please login to merge, or discard this patch.
src/Service/ProblemService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
         $validUris = [];
67 67
         $wanders = $this->wanderRepository->findAll();
68 68
         foreach ($wanders as $wander) {
69
-            $uri = $this->router->generate('wanders_show', [ 'id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL);
69
+            $uri = $this->router->generate('wanders_show', ['id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL);
70 70
             $validUris[$uri] = true; // Really I just want a hash that doesn't actually map
71 71
         }
72 72
 
73 73
         $images = $this->imageRepository->findAll();
74 74
         foreach ($images as $image) {
75
-            $uri = $this->router->generate('image_show', [ 'id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL);
75
+            $uri = $this->router->generate('image_show', ['id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL);
76 76
             $validUris[$uri] = true; // Really I just want a hash that doesn't actually map
77 77
         }
78 78
         $homepage = $this->router->generate('home', [], RouterInterface::ABSOLUTE_URL);
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
         // Okay, now we've got a list of all valid URIs, let's have a look through all our descriptions
81 81
 
82 82
         // Wanders first...
83
-        foreach($wanders as $wander) {
83
+        foreach ($wanders as $wander) {
84 84
             $description = $wander->getDescription();
85 85
 
86 86
             // Broken links
87
-            $links  = $this->markdownService->findLinks($description);
87
+            $links = $this->markdownService->findLinks($description);
88 88
             foreach ($links as $link) {
89 89
                 if (substr($link['uri'], 0, strlen($homepage)) == $homepage) {
90 90
                     if (!array_key_exists($link['uri'], $validUris)) {
91 91
                         $problem = new Problem();
92 92
                         $problem->setDescription('Wander ' . $wander->getId() . ' links to invalid URI: ' . $link['uri'] . ' (text is: "' . $link['text'] . '")');
93
-                        $problem->setUri($this->router->generate('wanders_show', [ 'id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
93
+                        $problem->setUri($this->router->generate('wanders_show', ['id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
94 94
                         $this->entityManager->persist($problem);
95 95
                     }
96 96
                 }
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
                 if (count($misspelledWords) > 0) {
104 104
                     $problem = new Problem();
105 105
                     $problem->setDescription('Wander ' . $wander->getId() . ' has potential spelling mistakes: ' . implode(", ", $misspelledWords));
106
-                    $problem->setUri($this->router->generate('wanders_show', [ 'id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
106
+                    $problem->setUri($this->router->generate('wanders_show', ['id' => $wander->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
107 107
                     $this->entityManager->persist($problem);
108 108
                 }
109 109
             }
110 110
         }
111 111
         $this->entityManager->flush();
112 112
         // ...then Images:
113
-        foreach($images as $image) {
113
+        foreach ($images as $image) {
114 114
             $description = $image->getDescription();
115 115
 
116 116
             // Broken links
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                     if (!array_key_exists($link['uri'], $validUris)) {
121 121
                         $problem = new Problem();
122 122
                         $problem->setDescription('Image ' . $image->getId() . ' links to invalid URI: ' . $link['uri'] . ' (text is: "' . $link['text'] . '")');
123
-                        $problem->setUri($this->router->generate('image_show', [ 'id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
123
+                        $problem->setUri($this->router->generate('image_show', ['id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
124 124
                         $this->entityManager->persist($problem);
125 125
                     }
126 126
                 }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 if (count($misspelledWords) > 0) {
134 134
                     $problem = new Problem();
135 135
                     $problem->setDescription('Image ' . $image->getId() . ' has potential spelling mistakes: ' . implode(", ", $misspelledWords));
136
-                    $problem->setUri($this->router->generate('image_show', [ 'id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
136
+                    $problem->setUri($this->router->generate('image_show', ['id' => $image->getId()], UrlGeneratorInterface::ABSOLUTE_URL));
137 137
                     $this->entityManager->persist($problem);
138 138
                 }
139 139
             }
Please login to merge, or discard this patch.