@@ -35,13 +35,13 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function handle(): int |
| 37 | 37 | { |
| 38 | - if (! Features::rss()) { |
|
| 38 | + if (!Features::rss()) { |
|
| 39 | 39 | $this->error('Cannot generate an RSS feed, please check your configuration.'); |
| 40 | 40 | |
| 41 | 41 | return 1; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $this->action('Generating RSS feed', function () { |
|
| 44 | + $this->action('Generating RSS feed', function() { |
|
| 45 | 45 | file_put_contents( |
| 46 | 46 | Hyde::getSiteOutputPath(RssFeedService::getDefaultOutputFilename()), |
| 47 | 47 | RssFeedService::generateFeed() |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use Hyde\Framework\Contracts\HydeKernelContract; |
| 4 | 4 | use Illuminate\Contracts\Support\Arrayable; |
| 5 | 5 | |
| 6 | -if (! function_exists('hyde')) { |
|
| 6 | +if (!function_exists('hyde')) { |
|
| 7 | 7 | /** |
| 8 | 8 | * Get the available HydeKernel instance. |
| 9 | 9 | * |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if (! function_exists('unslash')) { |
|
| 18 | +if (!function_exists('unslash')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Remove trailing slashes from the start and end of a string. |
| 21 | 21 | * |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -if (! function_exists('array_map_unique')) { |
|
| 31 | +if (!function_exists('array_map_unique')) { |
|
| 32 | 32 | /** |
| 33 | 33 | * Map a callback over an array and remove duplicates. |
| 34 | 34 | * |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function handle(): int |
| 39 | 39 | { |
| 40 | - $this->action('Generating documentation site search index', function () { |
|
| 40 | + $this->action('Generating documentation site search index', function() { |
|
| 41 | 41 | $expected = $this->guesstimateGenerationTime(); |
| 42 | 42 | if ($expected > 0) { |
| 43 | 43 | $this->line("<fg=gray> > This will take an estimated $expected seconds. Terminal may seem non-responsive.</>"); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | }, sprintf('Created <info>%s</info>', GeneratesDocumentationSearchIndexFile::$filePath)); |
| 48 | 48 | |
| 49 | 49 | if (config('docs.create_search_page', true)) { |
| 50 | - $this->action('Generating search page', function () { |
|
| 50 | + $this->action('Generating search page', function() { |
|
| 51 | 51 | file_put_contents( |
| 52 | 52 | Hyde::path(sprintf( |
| 53 | 53 | '_site/%s/search.html', |
@@ -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; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function getRoutes(?string $pageClass = null): self |
| 55 | 55 | { |
| 56 | - return ! $pageClass ? $this : $this->filter(function (RouteContract $route) use ($pageClass) { |
|
| 56 | + return !$pageClass ? $this : $this->filter(function(RouteContract $route) use ($pageClass) { |
|
| 57 | 57 | return $route->getSourceModel() instanceof $pageClass; |
| 58 | 58 | }); |
| 59 | 59 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | protected function discoverRoutes(): self |
| 81 | 81 | { |
| 82 | - $this->kernel->pages()->each(function (PageContract $page) { |
|
| 82 | + $this->kernel->pages()->each(function(PageContract $page) { |
|
| 83 | 83 | $this->discover($page); |
| 84 | 84 | }); |
| 85 | 85 | |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | /** @return $this */ |
| 16 | 16 | public function generate(): static |
| 17 | 17 | { |
| 18 | - Hyde::routes()->getRoutes(DocumentationPage::class)->each(function (Route $route) { |
|
| 19 | - if (! $route->getSourceModel()->get('hidden', false)) { |
|
| 20 | - $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function (NavItem $item) { |
|
| 18 | + Hyde::routes()->getRoutes(DocumentationPage::class)->each(function(Route $route) { |
|
| 19 | + if (!$route->getSourceModel()->get('hidden', false)) { |
|
| 20 | + $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function(NavItem $item) { |
|
| 21 | 21 | $item->title = $item->route->getSourceModel()->get('label'); |
| 22 | 22 | })); |
| 23 | 23 | } |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function getGroups(): array |
| 35 | 35 | { |
| 36 | - return $this->items->map(function (NavItem $item) { |
|
| 36 | + return $this->items->map(function(NavItem $item) { |
|
| 37 | 37 | return $item->getGroup(); |
| 38 | 38 | })->unique()->toArray(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function getItemsInGroup(?string $group): Collection |
| 42 | 42 | { |
| 43 | - return $this->items->filter(function ($item) use ($group) { |
|
| 43 | + return $this->items->filter(function($item) use ($group) { |
|
| 44 | 44 | return $item->getGroup() === $group || $item->getGroup() === Str::slug($group); |
| 45 | 45 | })->sortBy('priority')->values(); |
| 46 | 46 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | /** @return $this */ |
| 30 | 30 | public function generate(): static |
| 31 | 31 | { |
| 32 | - Hyde::routes()->each(function (Route $route) { |
|
| 32 | + Hyde::routes()->each(function(Route $route) { |
|
| 33 | 33 | $this->items->push(NavItem::fromRoute($route)); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - collect(config('hyde.navigation.custom', []))->each(function (NavItem $item) { |
|
| 36 | + collect(config('hyde.navigation.custom', []))->each(function(NavItem $item) { |
|
| 37 | 37 | $this->items->push($item); |
| 38 | 38 | }); |
| 39 | 39 | |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | protected function filterHiddenItems(): Collection |
| 61 | 61 | { |
| 62 | - return $this->items->reject(function (NavItem $item) { |
|
| 62 | + return $this->items->reject(function(NavItem $item) { |
|
| 63 | 63 | return $item->hidden; |
| 64 | 64 | })->values(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function filterDuplicateItems(): Collection |
| 68 | 68 | { |
| 69 | - return $this->items->unique(function (NavItem $item) { |
|
| 69 | + return $this->items->unique(function(NavItem $item) { |
|
| 70 | 70 | return $item->resolveLink(); |
| 71 | 71 | }); |
| 72 | 72 | } |
@@ -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 | } |