@@ -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(); |
@@ -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 | } |
@@ -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(); |
@@ -35,7 +35,7 @@ |
||
| 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)); |
@@ -66,13 +66,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function checkString(string $input): array |
| 25 | 25 | { |
| 26 | 26 | $misspelledWords = []; |
| 27 | - $results = $this->aspell->checkText(new StringSource($input), ['en_GB', 'en']); |
|
| 27 | + $results = $this->aspell->checkText(new StringSource($input), ['en_GB', 'en']); |
|
| 28 | 28 | // TODO: Something functional |
| 29 | 29 | foreach ($results as $result) { |
| 30 | 30 | $misspelledWords[] = $result->word; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | // https://gordalina.github.io/cachetool/ |
| 25 | 25 | // https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L55 |
| 26 | 26 | // https://github.com/gordalina/cachetool/releases/download/7.0.0/cachetool.phar |
| 27 | -set('bin/cachetool', function () { |
|
| 27 | +set('bin/cachetool', function() { |
|
| 28 | 28 | if (!test('[ -f {{release_or_current_path}}/cachetool.phar ]')) { |
| 29 | 29 | run("cd {{release_or_current_path}} && curl -sLO https://github.com/gordalina/cachetool/releases/download/7.0.0/cachetool.phar"); |
| 30 | 30 | } |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // Tasks |
| 75 | 75 | |
| 76 | -task('build', function () { |
|
| 76 | +task('build', function() { |
|
| 77 | 77 | run('cd {{release_path}} && build'); |
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | -task('deploy:stop-workers', function () { |
|
| 80 | +task('deploy:stop-workers', function() { |
|
| 81 | 81 | // Hack alert: https://stackoverflow.com/a/63652279/300836 |
| 82 | 82 | // We've just move the previous release out of the way, but it's |
| 83 | 83 | // the previous release's cache that has the details of the |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | })->desc('Stop any existing messenger consumers; Supervisor will restart them.'); |
| 89 | 89 | |
| 90 | 90 | // Testing |
| 91 | -task('pwd', function () { |
|
| 91 | +task('pwd', function() { |
|
| 92 | 92 | $result = run('pwd'); |
| 93 | 93 | writeln("Current dir: $result"); |
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | -task('test', function () { |
|
| 96 | +task('test', function() { |
|
| 97 | 97 | writeln('Hello world'); |
| 98 | 98 | }); |
| 99 | 99 | |