@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | /** @return $this */ |
| 17 | 17 | public function generate(): static |
| 18 | 18 | { |
| 19 | - Hyde::routes()->getRoutes(DocumentationPage::class)->each(function (Route $route) { |
|
| 20 | - $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function (NavItem $item) { |
|
| 19 | + Hyde::routes()->getRoutes(DocumentationPage::class)->each(function(Route $route) { |
|
| 20 | + $this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function(NavItem $item) { |
|
| 21 | 21 | $item->label = $item->route->getSourceModel()->get('navigation.label'); |
| 22 | 22 | })); |
| 23 | 23 | }); |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function getGroups(): array |
| 34 | 34 | { |
| 35 | - return $this->items->map(function (NavItem $item) { |
|
| 35 | + return $this->items->map(function(NavItem $item) { |
|
| 36 | 36 | return $item->getGroup(); |
| 37 | 37 | })->unique()->toArray(); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function getItemsInGroup(?string $group): Collection |
| 41 | 41 | { |
| 42 | - return $this->items->filter(function ($item) use ($group) { |
|
| 42 | + return $this->items->filter(function($item) use ($group) { |
|
| 43 | 43 | return $item->getGroup() === $group || $item->getGroup() === Str::slug($group); |
| 44 | 44 | })->sortBy('navigation.priority')->values(); |
| 45 | 45 | } |
@@ -51,6 +51,6 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | protected function filterDocumentationPage(NavItem $item): bool |
| 53 | 53 | { |
| 54 | - return ! parent::filterDocumentationPage($item); |
|
| 54 | + return !parent::filterDocumentationPage($item); |
|
| 55 | 55 | } |
| 56 | 56 | } |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | /** @return $this */ |
| 32 | 32 | public function generate(): static |
| 33 | 33 | { |
| 34 | - Hyde::routes()->each(function (Route $route) { |
|
| 34 | + Hyde::routes()->each(function(Route $route) { |
|
| 35 | 35 | $this->items->push(NavItem::fromRoute($route)); |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - collect(config('hyde.navigation.custom', []))->each(function (NavItem $item) { |
|
| 38 | + collect(config('hyde.navigation.custom', []))->each(function(NavItem $item) { |
|
| 39 | 39 | $this->items->push($item); |
| 40 | 40 | }); |
| 41 | 41 | |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | protected function filterHiddenItems(): Collection |
| 63 | 63 | { |
| 64 | - return $this->items->reject(function (NavItem $item) { |
|
| 64 | + return $this->items->reject(function(NavItem $item) { |
|
| 65 | 65 | return $item->hidden || $this->filterDocumentationPage($item); |
| 66 | 66 | })->values(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | protected function filterDuplicateItems(): Collection |
| 70 | 70 | { |
| 71 | - return $this->items->unique(function (NavItem $item) { |
|
| 71 | + return $this->items->unique(function(NavItem $item) { |
|
| 72 | 72 | return $item->resolveLink(); |
| 73 | 73 | }); |
| 74 | 74 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $route, |
| 53 | 53 | $route->getSourceModel()->navigationMenuLabel(), |
| 54 | 54 | $route->getSourceModel()->navigationMenuPriority(), |
| 55 | - ! $route->getSourceModel()->showInNavigation() |
|
| 55 | + !$route->getSourceModel()->showInNavigation() |
|
| 56 | 56 | ); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $current = Hyde::currentRoute()->getSourceModel(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if (! isset($this->route)) { |
|
| 100 | + if (!isset($this->route)) { |
|
| 101 | 101 | return ($current->getRoute()->getRouteKey() === $this->href) |
| 102 | 102 | || ($current->getRoute()->getRouteKey().'.html' === $this->href); |
| 103 | 103 | } |
@@ -38,11 +38,11 @@ |
||
| 38 | 38 | |
| 39 | 39 | protected function makeCanonicalUrl(): ?string |
| 40 | 40 | { |
| 41 | - if (! empty($this->matter('canonicalUrl'))) { |
|
| 41 | + if (!empty($this->matter('canonicalUrl'))) { |
|
| 42 | 42 | return $this->matter('canonicalUrl'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if (Hyde::hasSiteUrl() && ! empty($this->identifier)) { |
|
| 45 | + if (Hyde::hasSiteUrl() && !empty($this->identifier)) { |
|
| 46 | 46 | return $this->getRoute()->getQualifiedUrl(); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -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 (Route $route) use ($pageClass) { |
|
| 36 | + return !$pageClass ? $this : $this->filter(function(Route $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 (HydePage $page) { |
|
| 62 | + $this->kernel->pages()->each(function(HydePage $page) { |
|
| 63 | 63 | $this->discover($page); |
| 64 | 64 | }); |
| 65 | 65 | |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | protected function formatOutputPath(string $path): string |
| 58 | 58 | { |
| 59 | - if (! file_exists(Hyde::sitePath($path))) { |
|
| 59 | + if (!file_exists(Hyde::sitePath($path))) { |
|
| 60 | 60 | return "_site/$path"; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | |
| 51 | 51 | protected function getCacheBustKey(string $file): string |
| 52 | 52 | { |
| 53 | - if (! config('hyde.cache_busting', true)) { |
|
| 53 | + if (!config('hyde.cache_busting', true)) { |
|
| 54 | 54 | return ''; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | |
| 74 | 74 | public function failed(): bool |
| 75 | 75 | { |
| 76 | - return ! $this->passed; |
|
| 76 | + return !$this->passed; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function statusCode(): int |
@@ -196,7 +196,7 @@ |
||
| 196 | 196 | */ |
| 197 | 197 | public static function getFromSource(string $sourceFilePath): static |
| 198 | 198 | { |
| 199 | - return Hyde::routes()->first(function (Route $route) use ($sourceFilePath) { |
|
| 199 | + return Hyde::routes()->first(function(Route $route) use ($sourceFilePath) { |
|
| 200 | 200 | return $route->getSourcePath() === $sourceFilePath; |
| 201 | 201 | }) ?? throw new RouteNotFoundException($sourceFilePath); |
| 202 | 202 | } |