@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | protected function getEnvironmentVariables(): array |
83 | 83 | { |
84 | 84 | return Arr::whereNotNull([ |
85 | - 'HYDE_SERVER_REQUEST_OUTPUT' => ! $this->option('no-ansi'), |
|
85 | + 'HYDE_SERVER_REQUEST_OUTPUT' => !$this->option('no-ansi'), |
|
86 | 86 | 'HYDE_SERVER_SAVE_PREVIEW' => $this->parseEnvironmentOption('save-preview'), |
87 | 87 | 'HYDE_SERVER_DASHBOARD' => $this->parseEnvironmentOption('dashboard'), |
88 | 88 | 'HYDE_PRETTY_URLS' => $this->parseEnvironmentOption('pretty-urls'), |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function configureOutput(): void |
94 | 94 | { |
95 | - if (! $this->useBasicOutput()) { |
|
95 | + if (!$this->useBasicOutput()) { |
|
96 | 96 | $this->console = new ConsoleOutput($this->output->isVerbose()); |
97 | 97 | } |
98 | 98 | } |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | |
107 | 107 | protected function getOutputHandler(): Closure |
108 | 108 | { |
109 | - return $this->useBasicOutput() ? function (string $type, string $line): void { |
|
109 | + return $this->useBasicOutput() ? function(string $type, string $line): void { |
|
110 | 110 | $this->output->write($line); |
111 | 111 | } : $this->console->getFormatter(); |
112 | 112 | } |
113 | 113 | |
114 | 114 | protected function useBasicOutput(): bool |
115 | 115 | { |
116 | - return $this->option('no-ansi') || ! class_exists(ConsoleOutput::class); |
|
116 | + return $this->option('no-ansi') || !class_exists(ConsoleOutput::class); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | protected function parseEnvironmentOption(string $name): ?string |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $process = $binary ? Process::command($command)->run() : null; |
159 | 159 | |
160 | - if (! $process || $process->failed()) { |
|
160 | + if (!$process || $process->failed()) { |
|
161 | 161 | $this->warn('Unable to open the site preview in the browser on your system:'); |
162 | 162 | $this->line(sprintf(' %s', str_replace("\n", "\n ", $process ? $process->errorOutput() : "Missing suitable 'open' binary."))); |
163 | 163 | $this->newLine(); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function vendorPath(string $path = '', string $package = 'framework'): string |
138 | 138 | { |
139 | - if (PharSupport::running() && ! PharSupport::hasVendorDirectory()) { |
|
139 | + if (PharSupport::running() && !PharSupport::hasVendorDirectory()) { |
|
140 | 140 | return PharSupport::vendorPath($path, $package); |
141 | 141 | } |
142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function touch(string|array $path): bool |
152 | 152 | { |
153 | - return collect($path)->map(function (string $path): bool { |
|
153 | + return collect($path)->map(function(string $path): bool { |
|
154 | 154 | return touch($this->path($path)); |
155 | 155 | })->contains(false) === false; |
156 | 156 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function unlink(string|array $path): bool |
164 | 164 | { |
165 | - return collect($path)->map(function (string $path): bool { |
|
165 | + return collect($path)->map(function(string $path): bool { |
|
166 | 166 | return unlink($this->path($path)); |
167 | 167 | })->contains(false) === false; |
168 | 168 | } |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | /** @return array<string, DropdownNavItem> */ |
31 | 31 | public function getDropdowns(): array |
32 | 32 | { |
33 | - if (! $this->dropdownsEnabled()) { |
|
33 | + if (!$this->dropdownsEnabled()) { |
|
34 | 34 | throw new BadMethodCallException('Dropdowns are not enabled. Enable it by setting `hyde.navigation.subdirectories` to `dropdown`.'); |
35 | 35 | } |
36 | 36 | |
37 | - return $this->items->filter(function (NavItem $item): bool { |
|
37 | + return $this->items->filter(function(NavItem $item): bool { |
|
38 | 38 | return $item instanceof DropdownNavItem; |
39 | 39 | })->values()->all(); |
40 | 40 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | protected function canAddRoute(Route $route): bool |
63 | 63 | { |
64 | - return parent::canAddRoute($route) && (! $route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName())); |
|
64 | + return parent::canAddRoute($route) && (!$route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName())); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | protected function canAddItemToDropdown(NavItem $item): bool |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | private function hasGroupExplicitlySetInFrontMatter(): bool |
78 | 78 | { |
79 | - return $this->hasDropdowns ??= $this->items->contains(function (NavItem $item): bool { |
|
79 | + return $this->hasDropdowns ??= $this->items->contains(function(NavItem $item): bool { |
|
80 | 80 | return ($item->getGroup() !== null) && ($item->destination !== (string) DocumentationPage::home()); |
81 | 81 | }); |
82 | 82 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected function file(string $path, ?string $contents = null): void |
24 | 24 | { |
25 | - if (! is_dir(dirname($path))) { |
|
25 | + if (!is_dir(dirname($path))) { |
|
26 | 26 | $this->directory(dirname($path)); |
27 | 27 | } |
28 | 28 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if (sizeof($this->fileMemory) > 0) { |
64 | 64 | foreach ($this->fileMemory as $file) { |
65 | 65 | if (Filesystem::isDirectory($file)) { |
66 | - if (! in_array($file, ['_site', '_media', '_pages', '_posts', '_docs', 'app', 'config', 'storage', 'vendor', 'node_modules'])) { |
|
66 | + if (!in_array($file, ['_site', '_media', '_pages', '_posts', '_docs', 'app', 'config', 'storage', 'vendor', 'node_modules'])) { |
|
67 | 67 | Filesystem::deleteDirectory($file); |
68 | 68 | } |
69 | 69 | } else { |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | return match ($this->option('format')) { |
32 | 32 | 'txt' => $this->table($this->makeHeader($routes), $routes) ?? Command::SUCCESS, |
33 | - 'json' => $this->writeRaw(json_encode($routes, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)) ?? Command::SUCCESS, |
|
33 | + 'json' => $this->writeRaw(json_encode($routes, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)) ?? Command::SUCCESS, |
|
34 | 34 | default => $this->error("Invalid format provided. Only 'txt' and 'json' are supported.") ?? Command::FAILURE, |
35 | 35 | }; |
36 | 36 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | public function handle(): void |
23 | 23 | { |
24 | - if (! Hyde::hasSiteUrl()) { |
|
24 | + if (!Hyde::hasSiteUrl()) { |
|
25 | 25 | $this->skip('Cannot generate sitemap without a valid base URL'); |
26 | 26 | } |
27 | 27 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | static::needsDirectory(static::$sourceDirectory); |
55 | 55 | |
56 | - return new static(static::findFiles($name, 'md')->mapWithKeys(function (string $file): array { |
|
56 | + return new static(static::findFiles($name, 'md')->mapWithKeys(function(string $file): array { |
|
57 | 57 | return [static::makeIdentifier($file) => MarkdownFileParser::parse($file)]; |
58 | 58 | })); |
59 | 59 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | static::needsDirectory(static::$sourceDirectory); |
71 | 71 | |
72 | - return new static(static::findFiles($name, ['yaml', 'yml'])->mapWithKeys(function (string $file): array { |
|
72 | + return new static(static::findFiles($name, ['yaml', 'yml'])->mapWithKeys(function(string $file): array { |
|
73 | 73 | $content = Filesystem::get($file); |
74 | 74 | |
75 | 75 | if (str_starts_with($content, '---')) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | static::needsDirectory(static::$sourceDirectory); |
96 | 96 | |
97 | - return new static(static::findFiles($name, 'json')->mapWithKeys(function (string $file) use ($asArray): array { |
|
97 | + return new static(static::findFiles($name, 'json')->mapWithKeys(function(string $file) use ($asArray): array { |
|
98 | 98 | return [static::makeIdentifier($file) => json_decode(Filesystem::get($file), $asArray)]; |
99 | 99 | })); |
100 | 100 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | if ($this->hasYamlConfigFile()) { |
31 | 31 | $data = $this->parseYamlFile(); |
32 | 32 | |
33 | - if (! self::configurationContainsNamespaces($data)) { |
|
33 | + if (!self::configurationContainsNamespaces($data)) { |
|
34 | 34 | $data = ['hyde' => $data]; |
35 | 35 | } |
36 | 36 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | protected function canInjectSiteNameEnvironmentVariable(): bool |
36 | 36 | { |
37 | - return $this->yamlHasSiteNameSet() && ! $this->alreadyHasEnvironmentVariable(); |
|
37 | + return $this->yamlHasSiteNameSet() && !$this->alreadyHasEnvironmentVariable(); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | protected function alreadyHasEnvironmentVariable(): bool |