@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | protected function generate(): void |
| 21 | 21 | { |
| 22 | - Routes::getRoutes(DocumentationPage::class)->each(function (Route $route): void { |
|
| 22 | + Routes::getRoutes(DocumentationPage::class)->each(function(Route $route): void { |
|
| 23 | 23 | if ($this->canAddRoute($route)) { |
| 24 | 24 | $this->items->put($route->getRouteKey(), NavItem::fromRoute($route)); |
| 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 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function canAddRoute(Route $route): bool |
| 57 | 57 | { |
| 58 | - return parent::canAddRoute($route) && ! $route->is(DocumentationPage::homeRouteName()); |
|
| 58 | + return parent::canAddRoute($route) && !$route->is(DocumentationPage::homeRouteName()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | private function isPageIndexPage(): bool |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function hasDropdowns(): bool |
| 27 | 27 | { |
| 28 | - if (! $this->dropdownsEnabled()) { |
|
| 28 | + if (!$this->dropdownsEnabled()) { |
|
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | /** @return array<string, DropdownNavItem> */ |
| 36 | 36 | public function getDropdowns(): array |
| 37 | 37 | { |
| 38 | - if (! $this->dropdownsEnabled()) { |
|
| 38 | + if (!$this->dropdownsEnabled()) { |
|
| 39 | 39 | throw new BadMethodCallException('Dropdowns are not enabled. Enable it by setting `hyde.navigation.subdirectories` to `dropdown`.'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - return $this->items->filter(function (NavItem $item): bool { |
|
| 42 | + return $this->items->filter(function(NavItem $item): bool { |
|
| 43 | 43 | return $item instanceof DropdownNavItem; |
| 44 | 44 | })->values()->all(); |
| 45 | 45 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | protected function canAddRoute(Route $route): bool |
| 69 | 69 | { |
| 70 | - return parent::canAddRoute($route) && (! $route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName())); |
|
| 70 | + return parent::canAddRoute($route) && (!$route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName())); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | protected function canAddItemToDropdown(NavItem $item): bool |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | protected function generate(): void |
| 38 | 38 | { |
| 39 | - Routes::each(function (Route $route): void { |
|
| 39 | + Routes::each(function(Route $route): void { |
|
| 40 | 40 | if ($this->canAddRoute($route)) { |
| 41 | 41 | $this->items->put($route->getRouteKey(), NavItem::fromRoute($route)); |
| 42 | 42 | } |
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | - collect(Config::getArray('hyde.navigation.custom', []))->each(function (NavItem $item): void { |
|
| 45 | + collect(Config::getArray('hyde.navigation.custom', []))->each(function(NavItem $item): void { |
|
| 46 | 46 | // Since these were added explicitly by the user, we can assume they should always be shown |
| 47 | 47 | $this->items->push($item); |
| 48 | 48 | }); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | protected function removeDuplicateItems(): void |
| 57 | 57 | { |
| 58 | - $this->items = $this->items->unique(function (NavItem $item): string { |
|
| 58 | + $this->items = $this->items->unique(function(NavItem $item): string { |
|
| 59 | 59 | // Filter using a combination of the group and label to allow duplicate labels in different groups |
| 60 | 60 | return $item->getGroup().$item->label; |
| 61 | 61 | }); |