@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - /* |
|
| 3 | + /* |
|
| 4 | 4 | |-------------------------------------------------------------------------- |
| 5 | 5 | | Torchlight |
| 6 | 6 | |-------------------------------------------------------------------------- |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | throw new BadMethodCallException('Cannot register an extension after the Kernel has been booted.'); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if (! is_subclass_of($extension, HydeExtension::class)) { |
|
| 41 | + if (!is_subclass_of($extension, HydeExtension::class)) { |
|
| 42 | 42 | // We want to make sure that the extension class extends the HydeExtension class, |
| 43 | 43 | // so that we won't have to check the methods we need to call exist later on. |
| 44 | 44 | |
| 45 | 45 | throw new InvalidArgumentException('The specified class must extend the HydeExtension class.'); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if (! in_array($extension, $this->extensions, true)) { |
|
| 48 | + if (!in_array($extension, $this->extensions, true)) { |
|
| 49 | 49 | $this->extensions[] = $extension; |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | /** @return array<class-string<\Hyde\Pages\Concerns\HydePage>> */ |
| 60 | 60 | public function getRegisteredPageClasses(): array |
| 61 | 61 | { |
| 62 | - return array_unique(array_merge(...array_map(function (string $extension): array { |
|
| 62 | + return array_unique(array_merge(...array_map(function(string $extension): array { |
|
| 63 | 63 | /** @var <class-string<\Hyde\Foundation\Concerns\HydeExtension>> $extension */ |
| 64 | 64 | return $extension::getPageClasses(); |
| 65 | 65 | }, $this->getRegisteredExtensions()))); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /** @param class-string<\Hyde\Pages\Concerns\HydePage> $class */ |
| 57 | 57 | protected function formatSourcePath(string $path, string $class): string |
| 58 | 58 | { |
| 59 | - if (! $class::isDiscoverable()) { |
|
| 59 | + if (!$class::isDiscoverable()) { |
|
| 60 | 60 | return '<fg=yellow>dynamic</>'; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | protected function formatOutputPath(string $path): string |
| 67 | 67 | { |
| 68 | - if (! file_exists(Hyde::sitePath($path))) { |
|
| 68 | + if (!file_exists(Hyde::sitePath($path))) { |
|
| 69 | 69 | return "_site/$path"; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | { |
| 25 | 25 | public function generate(): static |
| 26 | 26 | { |
| 27 | - MarkdownPost::getLatestPosts()->each(function (MarkdownPost $post): void { |
|
| 27 | + MarkdownPost::getLatestPosts()->each(function(MarkdownPost $post): void { |
|
| 28 | 28 | $this->addItem($post); |
| 29 | 29 | }); |
| 30 | 30 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return $this->isInstanceOf(MarkdownPost::class) |
| 95 | 95 | || $this->searchForHiddenInFrontMatter() |
| 96 | 96 | || in_array($this->routeKey, Config::getArray('hyde.navigation.exclude', ['404'])) |
| 97 | - || ! $this->isInstanceOf(DocumentationPage::class) && $this->pageIsInSubdirectory() && ($this->getSubdirectoryConfiguration() === 'hidden'); |
|
| 97 | + || !$this->isInstanceOf(DocumentationPage::class) && $this->pageIsInSubdirectory() && ($this->getSubdirectoryConfiguration() === 'hidden'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | protected function makePriority(): int |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | protected function invert(?bool $value): ?bool |
| 197 | 197 | { |
| 198 | - return $value === null ? null : ! $value; |
|
| 198 | + return $value === null ? null : !$value; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | protected function offset(?int $value, int $offset): ?int |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | define('BASE_PATH', realpath(__DIR__.'/../../../')); |
| 13 | 13 | |
| 14 | -if (BASE_PATH === false || ! file_exists(BASE_PATH.'/hyde')) { |
|
| 14 | +if (BASE_PATH === false || !file_exists(BASE_PATH.'/hyde')) { |
|
| 15 | 15 | throw new InvalidArgumentException('This test suite must be run from the root of the hydephp/develop monorepo.'); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | ob_start(); |
| 19 | 19 | |
| 20 | -test('handle routes index page', function () { |
|
| 20 | +test('handle routes index page', function() { |
|
| 21 | 21 | putenv('SERVER_DASHBOARD=false'); |
| 22 | 22 | mockRoute(''); |
| 23 | 23 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | Filesystem::unlink('_site/index.html'); |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | -test('handle routes custom pages', function () { |
|
| 39 | +test('handle routes custom pages', function() { |
|
| 40 | 40 | mockRoute('foo'); |
| 41 | 41 | |
| 42 | 42 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Filesystem::unlink('_site/foo.html'); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | -test('handle routes pages with .html extension', function () { |
|
| 57 | +test('handle routes pages with .html extension', function() { |
|
| 58 | 58 | mockRoute('foo.html'); |
| 59 | 59 | |
| 60 | 60 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | Filesystem::unlink('_site/foo.html'); |
| 73 | 73 | }); |
| 74 | 74 | |
| 75 | -test('handle routes static assets', function () { |
|
| 75 | +test('handle routes static assets', function() { |
|
| 76 | 76 | mockRoute('media/app.css'); |
| 77 | 77 | |
| 78 | 78 | $kernel = new HttpKernel(); |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | expect($response->body)->toContain('/*! HydeFront v2.0.0'); |
| 86 | 86 | }); |
| 87 | 87 | |
| 88 | -test('handle throws route not found exception for missing route', function () { |
|
| 88 | +test('handle throws route not found exception for missing route', function() { |
|
| 89 | 89 | mockRoute('missing'); |
| 90 | 90 | |
| 91 | 91 | $kernel = new HttpKernel(); |
| 92 | 92 | $kernel->handle(new Request()); |
| 93 | 93 | })->throws(RouteNotFoundException::class, "Route not found: 'missing'"); |
| 94 | 94 | |
| 95 | -test('handle sends 404 error response for missing asset', function () { |
|
| 95 | +test('handle sends 404 error response for missing asset', function() { |
|
| 96 | 96 | mockRoute('missing.css'); |
| 97 | 97 | |
| 98 | 98 | $kernel = new HttpKernel(); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | // Filesystem::unlink('_site/foo.html'); |
| 124 | 124 | //})->skip('Underlying framework does not buffer headers (yet)'); |
| 125 | 125 | |
| 126 | -test('trailing slashes are normalized from route', function () { |
|
| 126 | +test('trailing slashes are normalized from route', function() { |
|
| 127 | 127 | mockRoute('foo/'); |
| 128 | 128 | |
| 129 | 129 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | Filesystem::unlink('_site/foo.html'); |
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | -test('docs uri path is rerouted to docs/index', function () { |
|
| 144 | +test('docs uri path is rerouted to docs/index', function() { |
|
| 145 | 145 | mockRoute('docs'); |
| 146 | 146 | |
| 147 | 147 | Filesystem::put('_docs/index.md', '# Hello World!'); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | Filesystem::unlink('_site/docs/index.html'); |
| 160 | 160 | }); |
| 161 | 161 | |
| 162 | -test('docs/search renders search page', function () { |
|
| 162 | +test('docs/search renders search page', function() { |
|
| 163 | 163 | mockRoute('docs/search'); |
| 164 | 164 | |
| 165 | 165 | $kernel = new HttpKernel(); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | Filesystem::unlink('_site/docs/search.html'); |
| 175 | 175 | }); |
| 176 | 176 | |
| 177 | -test('ping route returns ping response', function () { |
|
| 177 | +test('ping route returns ping response', function() { |
|
| 178 | 178 | mockRoute('ping'); |
| 179 | 179 | |
| 180 | 180 | $kernel = new HttpKernel(); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | ->and($response->statusMessage)->toBe('OK'); |
| 186 | 186 | }); |
| 187 | 187 | |
| 188 | -test('exception handling', function () { |
|
| 188 | +test('exception handling', function() { |
|
| 189 | 189 | $exception = new Exception('foo'); |
| 190 | 190 | $response = ExceptionHandler::handle($exception); |
| 191 | 191 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function getRoutes(?string $pageClass = null): self |
| 46 | 46 | { |
| 47 | - return ! $pageClass ? $this : $this->filter(function (Route $route) use ($pageClass): bool { |
|
| 47 | + return !$pageClass ? $this : $this->filter(function(Route $route) use ($pageClass) : bool { |
|
| 48 | 48 | return $route->getPage() instanceof $pageClass; |
| 49 | 49 | }); |
| 50 | 50 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | protected function runDiscovery(): self |
| 82 | 82 | { |
| 83 | - $this->kernel->pages()->each(function (HydePage $page): void { |
|
| 83 | + $this->kernel->pages()->each(function(HydePage $page): void { |
|
| 84 | 84 | $this->discover($page); |
| 85 | 85 | }); |
| 86 | 86 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function boot(): void |
| 31 | 31 | { |
| 32 | - if (! $this->readyToBoot || $this->booting) { |
|
| 32 | + if (!$this->readyToBoot || $this->booting) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** @return $this */ |
| 20 | 20 | public function generate(): static |
| 21 | 21 | { |
| 22 | - Routes::getRoutes(DocumentationPage::class)->each(function (Route $route): void { |
|
| 22 | + Routes::getRoutes(DocumentationPage::class)->each(function(Route $route): void { |
|
| 23 | 23 | $this->items->put($route->getRouteKey(), NavItem::fromRoute($route)); |
| 24 | 24 | }); |
| 25 | 25 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** @return array<string> */ |
| 35 | 35 | public function getGroups(): array |
| 36 | 36 | { |
| 37 | - return $this->items->map(function (NavItem $item): string { |
|
| 37 | + return $this->items->map(function(NavItem $item): string { |
|
| 38 | 38 | return $item->getGroup(); |
| 39 | 39 | })->unique()->toArray(); |
| 40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** @return Collection<\Hyde\Framework\Features\Navigation\NavItem> */ |
| 43 | 43 | public function getItemsInGroup(?string $group): Collection |
| 44 | 44 | { |
| 45 | - return $this->items->filter(function (NavItem $item) use ($group): bool { |
|
| 45 | + return $this->items->filter(function(NavItem $item) use ($group) : bool { |
|
| 46 | 46 | return ($item->getGroup() === $group) || ($item->getGroup() === Str::slug($group)); |
| 47 | 47 | })->sortBy('navigation.priority')->values(); |
| 48 | 48 | } |