@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | public function generate(): static |
31 | 31 | { |
32 | - Routes::all()->each(function (Route $route): void { |
|
32 | + Routes::all()->each(function(Route $route): void { |
|
33 | 33 | $this->addRoute($route); |
34 | 34 | }); |
35 | 35 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | public static function enabled(): bool |
36 | 36 | { |
37 | - return Config::getBool('docs.create_search_page', true) && ! static::anotherSearchPageExists(); |
|
37 | + return Config::getBool('docs.create_search_page', true) && !static::anotherSearchPageExists(); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public static function routeKey(): string |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | public static function extractDate(string $filepath): DateTimeInterface |
29 | 29 | { |
30 | - if (! preg_match(static::DATE_PATTERN, basename($filepath), $matches)) { |
|
30 | + if (!preg_match(static::DATE_PATTERN, basename($filepath), $matches)) { |
|
31 | 31 | throw new InvalidArgumentException('The given filepath does not contain a valid ISO 8601 date prefix.'); |
32 | 32 | } |
33 | 33 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @example ['twitter' => 'mr_hyde'] ($service => $handle) |
66 | 66 | */ |
67 | - public readonly ?array $socials; |
|
67 | + public readonly ? array $socials; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Construct a new Post Author instance with the given data. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getPosts(): PageCollection |
128 | 128 | { |
129 | - return MarkdownPost::getLatestPosts()->filter(function (MarkdownPost $post) { |
|
129 | + return MarkdownPost::getLatestPosts()->filter(function(MarkdownPost $post) { |
|
130 | 130 | return $post->author?->username === $this->username; |
131 | 131 | }); |
132 | 132 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | if (isset($parentPath)) { |
54 | 54 | $parentPaths = explode('/', $parentPath); |
55 | - $parentPaths = array_map(function (string $part): string { |
|
55 | + $parentPaths = array_map(function(string $part): string { |
|
56 | 56 | return static::hasNumericalPrefix($part) ? static::splitNumericPrefix($part)[1] : $part; |
57 | 57 | }, $parentPaths); |
58 | 58 | $parentPath = implode('/', $parentPaths); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getActiveGroup(): ?NavigationGroup |
68 | 68 | { |
69 | - if ($this->items->isEmpty() || (! $this->hasGroups()) || (! $this->isCollapsible()) || Render::getPage() === null) { |
|
69 | + if ($this->items->isEmpty() || (!$this->hasGroups()) || (!$this->isCollapsible()) || Render::getPage() === null) { |
|
70 | 70 | return null; |
71 | 71 | } |
72 | 72 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | /** @var ?NavigationGroup $first */ |
81 | - $first = $this->items->first(function (NavigationGroup $group) use ($currentPage): bool { |
|
81 | + $first = $this->items->first(function(NavigationGroup $group) use ($currentPage): bool { |
|
82 | 82 | // A group is active when it contains the current page being rendered. |
83 | 83 | return $currentPage->navigationMenuGroup() && $group->getGroupKey() === NavigationGroup::normalizeGroupKey($currentPage->navigationMenuGroup()); |
84 | 84 | }); |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | protected function containsOnlyDocumentationPages(): bool |
54 | 54 | { |
55 | - return count($this->getItems()) && $this->getItems()->every(function (NavigationItem $item): bool { |
|
55 | + return count($this->getItems()) && $this->getItems()->every(function(NavigationItem $item): bool { |
|
56 | 56 | return $item->getPage() instanceof DocumentationPage; |
57 | 57 | }); |
58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function generate(): void |
68 | 68 | { |
69 | - $this->routes->each(function (Route $route): void { |
|
69 | + $this->routes->each(function(Route $route): void { |
|
70 | 70 | if ($this->canAddRoute($route)) { |
71 | 71 | if ($this->canGroupRoute($route)) { |
72 | 72 | $this->addRouteToGroup($route); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $this->items->push(NavigationItem::create(DocumentationPage::home())); |
83 | 83 | } |
84 | 84 | } else { |
85 | - collect(Config::getArray('hyde.navigation.custom', []))->each(function (array $data): void { |
|
85 | + collect(Config::getArray('hyde.navigation.custom', []))->each(function(array $data): void { |
|
86 | 86 | /** @var array{destination: string, label: ?string, priority: ?int, attributes: array<string, scalar>} $data */ |
87 | 87 | $message = 'Invalid navigation item configuration detected the configuration file. Please double check the syntax.'; |
88 | 88 | $item = InvalidConfigurationException::try(fn () => NavigationItem::create(...$data), $message); |
@@ -107,28 +107,28 @@ discard block |
||
107 | 107 | |
108 | 108 | protected function canAddRoute(Route $route): bool |
109 | 109 | { |
110 | - if (! $route->getPage()->showInNavigation()) { |
|
110 | + if (!$route->getPage()->showInNavigation()) { |
|
111 | 111 | return false; |
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($this->generatesSidebar) { |
115 | 115 | // Since the index page is linked in the header, we don't want it in the sidebar |
116 | - return ! $route->is(DocumentationPage::homeRouteName()); |
|
116 | + return !$route->is(DocumentationPage::homeRouteName()); |
|
117 | 117 | } else { |
118 | 118 | // While we for the most part can rely on the navigation visibility state provided by the navigation data factory, |
119 | 119 | // we need to make an exception for documentation pages, which generally have a visible state, as the data is |
120 | 120 | // also used in the sidebar. But we only want the documentation index page to be in the main navigation. |
121 | - return ! $route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName()); |
|
121 | + return !$route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName()); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | 125 | protected function canGroupRoute(Route $route): bool |
126 | 126 | { |
127 | - if (! $this->generatesSidebar) { |
|
127 | + if (!$this->generatesSidebar) { |
|
128 | 128 | return $route->getPage()->navigationMenuGroup() !== null; |
129 | 129 | } |
130 | 130 | |
131 | - if (! $this->usesGroups) { |
|
131 | + if (!$this->usesGroups) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | $groupItem->add($item); |
148 | 148 | |
149 | - if (! $this->items->has($groupItem->getGroupKey())) { |
|
149 | + if (!$this->items->has($groupItem->getGroupKey())) { |
|
150 | 150 | $this->items->put($groupItem->getGroupKey(), $groupItem); |
151 | 151 | } |
152 | 152 | } |
@@ -42,8 +42,8 @@ |
||
42 | 42 | |
43 | 43 | protected function run(): void |
44 | 44 | { |
45 | - DocumentationPage::all()->each(function (DocumentationPage $page): void { |
|
46 | - if (! in_array($page->identifier, $this->getPagesToExcludeFromSearch())) { |
|
45 | + DocumentationPage::all()->each(function(DocumentationPage $page): void { |
|
46 | + if (!in_array($page->identifier, $this->getPagesToExcludeFromSearch())) { |
|
47 | 47 | $this->index->push($this->generatePageEntry($page)); |
48 | 48 | } |
49 | 49 | }); |