@@ -16,7 +16,7 @@ |
||
| 16 | 16 | return '<link rel="'.e($this->rel).'" href="'.e($this->href).'">'; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - $attributes = collect($this->attr)->map(function ($value, $key) { |
|
| 19 | + $attributes = collect($this->attr)->map(function($value, $key) { |
|
| 20 | 20 | return e($key).'="'.e($value).'"'; |
| 21 | 21 | })->implode(' '); |
| 22 | 22 | |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | /** @return $this */ |
| 13 | 13 | public function generate(): static |
| 14 | 14 | { |
| 15 | - RoutingService::getInstance()->getRoutesForModel(DocumentationPage::class)->each(function (Route $route) { |
|
| 16 | - if (! $route->getSourceModel()->get('hidden', false)) { |
|
| 17 | - $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function (NavItem $item) { |
|
| 15 | + RoutingService::getInstance()->getRoutesForModel(DocumentationPage::class)->each(function(Route $route) { |
|
| 16 | + if (!$route->getSourceModel()->get('hidden', false)) { |
|
| 17 | + $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function(NavItem $item) { |
|
| 18 | 18 | $item->title = $item->route->getSourceModel()->get('label'); |
| 19 | 19 | })); |
| 20 | 20 | } |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function getGroups(): array |
| 32 | 32 | { |
| 33 | - return $this->items->map(function (NavItem $item) { |
|
| 33 | + return $this->items->map(function(NavItem $item) { |
|
| 34 | 34 | return $item->getGroup(); |
| 35 | 35 | })->unique()->toArray(); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getItemsInGroup(?string $group): Collection |
| 39 | 39 | { |
| 40 | - return $this->items->filter(function ($item) use ($group) { |
|
| 40 | + return $this->items->filter(function($item) use ($group) { |
|
| 41 | 41 | return $item->getGroup() === $group || $item->getGroup() === Str::slug($group); |
| 42 | 42 | })->sortBy('priority')->values(); |
| 43 | 43 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | public function getRoutesForModel(string $pageClass): self |
| 45 | 45 | { |
| 46 | 46 | // Return a new filtered collection with only routes that are for the given page class. |
| 47 | - return $this->filter(function (RouteContract $route) use ($pageClass) { |
|
| 47 | + return $this->filter(function(RouteContract $route) use ($pageClass) { |
|
| 48 | 48 | return $route->getSourceModel() instanceof $pageClass; |
| 49 | 49 | }); |
| 50 | 50 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | protected function discoverRoutes(): self |
| 72 | 72 | { |
| 73 | - $this->kernel->pages()->each(function (PageContract $page) { |
|
| 73 | + $this->kernel->pages()->each(function(PageContract $page) { |
|
| 74 | 74 | $this->discover($page); |
| 75 | 75 | }); |
| 76 | 76 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function pages(): PageCollection |
| 103 | 103 | { |
| 104 | - if (! $this->booted) { |
|
| 104 | + if (!$this->booted) { |
|
| 105 | 105 | $this->boot(); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function routes(): RouteCollection |
| 112 | 112 | { |
| 113 | - if (! $this->booted) { |
|
| 113 | + if (!$this->booted) { |
|
| 114 | 114 | $this->boot(); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -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 | } |
@@ -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 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected function compileRoute(): \Closure |
| 98 | 98 | { |
| 99 | - return function (Route $route) { |
|
| 99 | + return function(Route $route) { |
|
| 100 | 100 | return (new StaticPageBuilder($route->getSourceModel()))->__invoke(); |
| 101 | 101 | }; |
| 102 | 102 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | protected function isItSafeToCleanOutputDirectory(): bool |
| 110 | 110 | { |
| 111 | - if (! $this->isOutputDirectoryWhitelisted() && ! $this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
| 111 | + if (!$this->isOutputDirectoryWhitelisted() && !$this->askIfUnsafeDirectoryShouldBeEmptied()) { |
|
| 112 | 112 | $this->info('Output directory will not be emptied.'); |
| 113 | 113 | |
| 114 | 114 | return false; |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function handle(): int |
| 37 | 37 | { |
| 38 | - if (! $this->runPreflightCheck()) { |
|
| 38 | + if (!$this->runPreflightCheck()) { |
|
| 39 | 39 | return 1; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $this->action('Generating sitemap', function () { |
|
| 42 | + $this->action('Generating sitemap', function() { |
|
| 43 | 43 | file_put_contents( |
| 44 | 44 | Hyde::getSiteOutputPath('sitemap.xml'), |
| 45 | 45 | SitemapService::generateSitemap() |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | protected function runPreflightCheck(): bool |
| 53 | 53 | { |
| 54 | - if (! Features::sitemap()) { |
|
| 54 | + if (!Features::sitemap()) { |
|
| 55 | 55 | $this->error('Cannot generate sitemap.xml, please check your configuration.'); |
| 56 | 56 | |
| 57 | - if (! Hyde::hasSiteUrl()) { |
|
| 57 | + if (!Hyde::hasSiteUrl()) { |
|
| 58 | 58 | $this->warn('Hint: You don\'t have a site URL configured. Check config/hyde.php'); |
| 59 | 59 | } |
| 60 | 60 | if (config('site.generate_sitemap', true) !== true) { |
| 61 | 61 | $this->warn('Hint: You have disabled sitemap generation in config/hyde.php'); |
| 62 | 62 | $this->line(' > You can enable sitemap generation by setting <info>`site.generate_sitemap`</> to <info>`true`</>'); |
| 63 | 63 | } |
| 64 | - if (! extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
| 64 | + if (!extension_loaded('simplexml') || config('testing.mock_disabled_extensions', false) === true) { |
|
| 65 | 65 | $this->warn('Hint: You don\'t have the <info>`simplexml`</> extension installed. Check your PHP installation.'); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -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 | * |