@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | protected static function discoverMediaFiles(): Collection |
36 | 36 | { |
37 | - return collect(static::getMediaFiles())->mapWithKeys(function (string $path): array { |
|
37 | + return collect(static::getMediaFiles())->mapWithKeys(function(string $path): array { |
|
38 | 38 | $file = MediaFile::make($path); |
39 | 39 | |
40 | 40 | return [$file->getIdentifier() => $file]; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** @var Repository $config */ |
44 | 44 | $config = $app->make('config'); |
45 | 45 | |
46 | - tap($config, function (Repository $config): void { |
|
46 | + tap($config, function(Repository $config): void { |
|
47 | 47 | $this->config = $config->all(); |
48 | 48 | $this->mergeParsedConfiguration(); |
49 | 49 | })->set($this->config); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function parseAuthors(array $authors): array |
79 | 79 | { |
80 | - return Arr::mapWithKeys($authors, function (array $author, string $username): array { |
|
80 | + return Arr::mapWithKeys($authors, function(array $author, string $username): array { |
|
81 | 81 | $message = 'Invalid author configuration detected in the YAML config file. Please double check the syntax.'; |
82 | 82 | |
83 | 83 | return InvalidConfigurationException::try(fn () => [$username => PostAuthor::create($author)], $message); |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function parseFeatures(array $features): array |
92 | 92 | { |
93 | - return array_map(function (string $feature): Feature { |
|
93 | + return array_map(function(string $feature): Feature { |
|
94 | 94 | $name = Str::studly($feature); |
95 | 95 | $case = Feature::fromName($name); |
96 | 96 | |
97 | - if (! $case) { |
|
97 | + if (!$case) { |
|
98 | 98 | throw new InvalidConfigurationException("Invalid feature '$feature' specified in the YAML config file. (Feature::$name does not exist)"); |
99 | 99 | } |
100 | 100 |
@@ -14,12 +14,12 @@ |
||
14 | 14 | { |
15 | 15 | public function register(): void |
16 | 16 | { |
17 | - $this->app->make(HydeKernel::class)->booted(function (): void { |
|
18 | - $this->app->singleton('navigation.main', function (): MainNavigationMenu { |
|
17 | + $this->app->make(HydeKernel::class)->booted(function(): void { |
|
18 | + $this->app->singleton('navigation.main', function(): MainNavigationMenu { |
|
19 | 19 | return NavigationMenuGenerator::handle(MainNavigationMenu::class); |
20 | 20 | }); |
21 | 21 | |
22 | - $this->app->singleton('navigation.sidebar', function (): DocumentationSidebar { |
|
22 | + $this->app->singleton('navigation.sidebar', function(): DocumentationSidebar { |
|
23 | 23 | return NavigationMenuGenerator::handle(DocumentationSidebar::class); |
24 | 24 | }); |
25 | 25 | }); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected static function discover(string $name, array|string $extensions, callable $parseUsing, array $extraArgs = []): static |
90 | 90 | { |
91 | - return new static(static::findFiles($name, $extensions)->mapWithKeys(function (string $file) use ($parseUsing, $extraArgs): array { |
|
91 | + return new static(static::findFiles($name, $extensions)->mapWithKeys(function(string $file) use ($parseUsing, $extraArgs): array { |
|
92 | 92 | try { |
93 | 93 | $parsed = $parseUsing($file, ...$extraArgs); |
94 | 94 | } catch (ParseException $exception) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $contents = Filesystem::getContents($file); |
142 | 142 | |
143 | - if (! json_validate($contents)) { |
|
143 | + if (!json_validate($contents)) { |
|
144 | 144 | throw new ParseException(json_last_error_msg()); |
145 | 145 | } |
146 | 146 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function get(string $filename, ?string $default = null): ?string |
52 | 52 | { |
53 | - return static::getInclude(fn (string $contents): string => $contents, $filename, $default); |
|
53 | + return static::getInclude(fn (string $contents) : string => $contents, $filename, $default); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | protected static function getFileContents(string $path): ?string |
111 | 111 | { |
112 | - if (! Filesystem::exists($path)) { |
|
112 | + if (!Filesystem::exists($path)) { |
|
113 | 113 | return null; |
114 | 114 | } |
115 | 115 |
@@ -234,7 +234,7 @@ |
||
234 | 234 | |
235 | 235 | protected function ensureInstanceIsBooted(string $property): void |
236 | 236 | { |
237 | - if (! isset($this->$property)) { |
|
237 | + if (!isset($this->$property)) { |
|
238 | 238 | $this->boot(); |
239 | 239 | } |
240 | 240 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | private function isNonDocumentationPageInHiddenSubdirectory(): bool |
149 | 149 | { |
150 | - return ! $this->isInstanceOf(DocumentationPage::class) |
|
150 | + return !$this->isInstanceOf(DocumentationPage::class) |
|
151 | 151 | && $this->pageIsInSubdirectory() |
152 | 152 | && $this->getSubdirectoryConfiguration() === 'hidden' |
153 | 153 | && basename($this->identifier) !== 'index'; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $pageKey = $this->{$pageKeyName}; |
230 | 230 | |
231 | 231 | // Check if the config entry is a flat array or a keyed array. |
232 | - if (! array_key_exists($pageKey, $config)) { |
|
232 | + if (!array_key_exists($pageKey, $config)) { |
|
233 | 233 | // Adding an offset makes so that pages with a front matter priority, or |
234 | 234 | // explicit keyed priority selection that is lower can be shown first. |
235 | 235 | // This is all to make it easier to mix ways of adding priorities. |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | |
246 | 246 | private function checkFilePrefixForOrder(): ?int |
247 | 247 | { |
248 | - if (! $this->isInstanceOf(DocumentationPage::class)) { |
|
248 | + if (!$this->isInstanceOf(DocumentationPage::class)) { |
|
249 | 249 | return null; |
250 | 250 | } |
251 | 251 | |
252 | - if (! NumericalPageOrderingHelper::hasNumericalPrefix($this->identifier)) { |
|
252 | + if (!NumericalPageOrderingHelper::hasNumericalPrefix($this->identifier)) { |
|
253 | 253 | return null; |
254 | 254 | } |
255 | 255 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | protected function invert(?bool $value): ?bool |
287 | 287 | { |
288 | - return $value === null ? null : ! $value; |
|
288 | + return $value === null ? null : !$value; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | protected function offset(?int $value, int $offset): ?int |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | public function addExtension(string $extensionClassName): void |
101 | 101 | { |
102 | - if (! in_array($extensionClassName, $this->extensions)) { |
|
102 | + if (!in_array($extensionClassName, $this->extensions)) { |
|
103 | 103 | $this->extensions[] = $extensionClassName; |
104 | 104 | } |
105 | 105 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | public function addFeature(string $feature): static |
142 | 142 | { |
143 | - if (! in_array($feature, $this->features)) { |
|
143 | + if (!in_array($feature, $this->features)) { |
|
144 | 144 | $this->features[] = $feature; |
145 | 145 | } |
146 | 146 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | |
173 | 173 | protected function determineIfTorchlightAttributionShouldBeInjected(): bool |
174 | 174 | { |
175 | - return ! $this->isDocumentationPage() |
|
176 | - && ! (isset($this->pageClass) && $this->pageClass === MarkdownDocument::class) |
|
175 | + return !$this->isDocumentationPage() |
|
176 | + && !(isset($this->pageClass) && $this->pageClass === MarkdownDocument::class) |
|
177 | 177 | && Config::getBool('torchlight.attribution.enabled', true) |
178 | 178 | && str_contains($this->html, 'Syntax highlighted by torchlight.dev'); |
179 | 179 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function check_documentation_site_has_an_index_page(Result $result): Result |
81 | 81 | { |
82 | - if (! Features::hasDocumentationPages()) { |
|
82 | + if (!Features::hasDocumentationPages()) { |
|
83 | 83 | return $result->skip('Does documentation site have an index page?') |
84 | 84 | ->withTip('Skipped because: The documentation page feature is disabled in config'); |
85 | 85 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | public function check_a_torchlight_api_token_is_set(Result $result): Result |
127 | 127 | { |
128 | - if (! Features::has(Feature::Torchlight)) { |
|
128 | + if (!Features::has(Feature::Torchlight)) { |
|
129 | 129 | return $result->skip('Check a Torchlight API token is set') |
130 | 130 | ->withTip('Torchlight is an API for code syntax highlighting. You can enable it in the Hyde config.'); |
131 | 131 | } |