@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | return [ |
29 | 29 | 'title' => $this->getNavigationMenuTitle(), |
30 | - 'hidden' => ! $this->getNavigationMenuVisible(), |
|
30 | + 'hidden' => !$this->getNavigationMenuVisible(), |
|
31 | 31 | 'priority' => $this->getNavigationMenuPriority(), |
32 | 32 | ]; |
33 | 33 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | if ($this->page instanceof DocumentationPage) { |
63 | - return $this->page->identifier === 'index' && ! in_array($this->page->routeKey, config('hyde.navigation.exclude', [])); |
|
63 | + return $this->page->identifier === 'index' && !in_array($this->page->routeKey, config('hyde.navigation.exclude', [])); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if ($this->page->matter('navigation.hidden', false)) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function compileStaticPages(): void |
36 | 36 | { |
37 | - $this->getDiscoveredModels()->each(function (string $pageClass) { |
|
37 | + $this->getDiscoveredModels()->each(function(string $pageClass) { |
|
38 | 38 | $this->compilePagesForClass($pageClass); |
39 | 39 | }); |
40 | 40 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $this->withProgressBar( |
62 | 62 | $collection, |
63 | - function ($filepath) { |
|
63 | + function($filepath) { |
|
64 | 64 | copy($filepath, Hyde::getSiteOutputPath('media/'.basename($filepath))); |
65 | 65 | } |
66 | 66 | ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected function getDiscoveredModels(): RouteCollection |
74 | 74 | { |
75 | - return $this->router->getRoutes()->map(function (Route $route) { |
|
75 | + return $this->router->getRoutes()->map(function(Route $route) { |
|
76 | 76 | return $route->getPageType(); |
77 | 77 | })->unique(); |
78 | 78 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /** @psalm-return \Closure(Route):string */ |
95 | 95 | protected function compileRoute(): \Closure |
96 | 96 | { |
97 | - return function (Route $route) { |
|
97 | + return function(Route $route) { |
|
98 | 98 | return (new StaticPageBuilder($route->getSourceModel()))->__invoke(); |
99 | 99 | }; |
100 | 100 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | protected function isItSafeToCleanOutputDirectory(): bool |
108 | 108 | { |
109 | - if (! $this->isOutputDirectoryWhitelisted() && ! $this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
109 | + if (!$this->isOutputDirectoryWhitelisted() && !$this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
110 | 110 | $this->info('Output directory will not be emptied.'); |
111 | 111 | |
112 | 112 | return false; |
@@ -112,7 +112,7 @@ |
||
112 | 112 | /** @inheritDoc */ |
113 | 113 | public static function getFromSource(string $sourceFilePath): static |
114 | 114 | { |
115 | - return Hyde::routes()->first(function (RouteContract $route) use ($sourceFilePath) { |
|
115 | + return Hyde::routes()->first(function(RouteContract $route) use ($sourceFilePath) { |
|
116 | 116 | return $route->getSourceFilePath() === $sourceFilePath; |
117 | 117 | }) ?? throw new RouteNotFoundException($sourceFilePath); |
118 | 118 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Illuminate\Support\Facades\File; |
4 | 4 | |
5 | -if (! function_exists('unlinkIfExists')) { |
|
5 | +if (!function_exists('unlinkIfExists')) { |
|
6 | 6 | function unlinkIfExists(string $filepath): void |
7 | 7 | { |
8 | 8 | if (file_exists($filepath)) { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | -if (! function_exists('backupDirectory')) { |
|
14 | +if (!function_exists('backupDirectory')) { |
|
15 | 15 | /** @deprecated v0.60.x - You should not run tests in a production environment. */ |
16 | 16 | function backupDirectory(string $directory): void |
17 | 17 | { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | -if (! function_exists('restoreDirectory')) { |
|
24 | +if (!function_exists('restoreDirectory')) { |
|
25 | 25 | /** @deprecated v0.60.x - You should not run tests in a production environment. */ |
26 | 26 | function restoreDirectory(string $directory): void |
27 | 27 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if (! function_exists('deleteDirectory')) { |
|
35 | +if (!function_exists('deleteDirectory')) { |
|
36 | 36 | function deleteDirectory(string $directory): void |
37 | 37 | { |
38 | 38 | if (file_exists($directory)) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | -if (! function_exists('unlinkUnlessDefault')) { |
|
44 | +if (!function_exists('unlinkUnlessDefault')) { |
|
45 | 45 | function unlinkUnlessDefault(string $filepath): void |
46 | 46 | { |
47 | 47 | $protected = [ |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | '.gitkeep', |
52 | 52 | ]; |
53 | 53 | |
54 | - if (! in_array(basename($filepath), $protected)) { |
|
54 | + if (!in_array(basename($filepath), $protected)) { |
|
55 | 55 | unlink($filepath); |
56 | 56 | } |
57 | 57 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function getPages(?string $pageClass = null): self |
36 | 36 | { |
37 | - return ! $pageClass ? $this : $this->filter(function (PageContract $page) use ($pageClass): bool { |
|
37 | + return !$pageClass ? $this : $this->filter(function(PageContract $page) use ($pageClass) : bool { |
|
38 | 38 | return $page instanceof $pageClass; |
39 | 39 | }); |
40 | 40 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | protected function discoverPagesFor(string $pageClass): void |
64 | 64 | { |
65 | - $this->parsePagesFor($pageClass)->each(function ($page) { |
|
65 | + $this->parsePagesFor($pageClass)->each(function($page) { |
|
66 | 66 | $this->discover($page); |
67 | 67 | }); |
68 | 68 | } |
@@ -18,26 +18,26 @@ discard block |
||
18 | 18 | { |
19 | 19 | public function getSourceFiles(?string $pageClass = null): self |
20 | 20 | { |
21 | - return ! $pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
21 | + return !$pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function getAllSourceFiles(): self |
25 | 25 | { |
26 | - return $this->filter(function (File $file) { |
|
26 | + return $this->filter(function(File $file) { |
|
27 | 27 | return $file->belongsTo !== null; |
28 | 28 | }); |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function getSourceFilesFor(string $pageClass): self |
32 | 32 | { |
33 | - return $this->filter(function (File $file) use ($pageClass): bool { |
|
33 | + return $this->filter(function(File $file) use ($pageClass): bool { |
|
34 | 34 | return $file->belongsTo() === $pageClass; |
35 | 35 | }); |
36 | 36 | } |
37 | 37 | |
38 | 38 | public function getMediaFiles(): self |
39 | 39 | { |
40 | - return $this->filter(function (File $file): bool { |
|
40 | + return $this->filter(function(File $file): bool { |
|
41 | 41 | return str_starts_with($file, '_media'); |
42 | 42 | }); |
43 | 43 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | // Scan the source directory, and directories therein, for files that match the model's file extension. |
72 | 72 | foreach (glob($this->kernel->path($pageClass::qualifyBasename('{*,**/*}')), GLOB_BRACE) as $filepath) { |
73 | - if (! str_starts_with(basename($filepath), '_')) { |
|
73 | + if (!str_starts_with(basename($filepath), '_')) { |
|
74 | 74 | $this->put($this->kernel->pathToRelative($filepath), File::make($filepath)->belongsTo($pageClass)); |
75 | 75 | } |
76 | 76 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | public function getRoutes(?string $pageClass = null): self |
35 | 35 | { |
36 | - return ! $pageClass ? $this : $this->filter(function (RouteContract $route) use ($pageClass) { |
|
36 | + return !$pageClass ? $this : $this->filter(function(RouteContract $route) use ($pageClass) { |
|
37 | 37 | return $route->getSourceModel() instanceof $pageClass; |
38 | 38 | }); |
39 | 39 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | protected function runDiscovery(): self |
61 | 61 | { |
62 | - $this->kernel->pages()->each(function (PageContract $page) { |
|
62 | + $this->kernel->pages()->each(function(PageContract $page) { |
|
63 | 63 | $this->discover($page); |
64 | 64 | }); |
65 | 65 |
@@ -36,12 +36,12 @@ |
||
36 | 36 | */ |
37 | 37 | public static function getSourceFileListForModel(string $model): array |
38 | 38 | { |
39 | - if (! class_exists($model) || ! is_subclass_of($model, AbstractPage::class)) { |
|
39 | + if (!class_exists($model) || !is_subclass_of($model, AbstractPage::class)) { |
|
40 | 40 | throw new UnsupportedPageTypeException($model); |
41 | 41 | } |
42 | 42 | |
43 | 43 | $files = []; |
44 | - Hyde::files()->getSourceFiles($model)->each(function (File $file) use (&$files, $model) { |
|
44 | + Hyde::files()->getSourceFiles($model)->each(function(File $file) use (&$files, $model) { |
|
45 | 45 | $files[] = self::formatSlugForModel($model, $file->withoutDirectoryPrefix()); |
46 | 46 | }); |
47 | 47 |
@@ -149,7 +149,7 @@ |
||
149 | 149 | |
150 | 150 | protected function needsToBeBooted(): void |
151 | 151 | { |
152 | - if (! $this->booted) { |
|
152 | + if (!$this->booted) { |
|
153 | 153 | $this->boot(); |
154 | 154 | } |
155 | 155 | } |