@@ -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 |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function mediaLink(string $destination, bool $validate = false): string |
97 | 97 | { |
98 | - if ($validate && ! file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) { |
|
98 | + if ($validate && !file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) { |
|
99 | 99 | throw new FileNotFoundException($sourcePath); |
100 | 100 | } |
101 | 101 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | $value = Config::getNullableString('hyde.url'); |
135 | 135 | |
136 | - return ! blank($value) && $value !== 'http://localhost'; |
|
136 | + return !blank($value) && $value !== 'http://localhost'; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | // Since v1.7.0, we return the relative path even if the base URL is not set, |
155 | 155 | // as this is more likely to be the desired behavior the user's expecting. |
156 | - if (! blank($path)) { |
|
156 | + if (!blank($path)) { |
|
157 | 157 | return $path; |
158 | 158 | } |
159 | 159 |
@@ -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 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Hyde\Foundation\HydeKernel; |
7 | 7 | use JetBrains\PhpStorm\Deprecated; |
8 | 8 | |
9 | - if (! function_exists('hyde')) { |
|
9 | + if (!function_exists('hyde')) { |
|
10 | 10 | /** |
11 | 11 | * Get the available HydeKernel instance. |
12 | 12 | */ |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | - if (! function_exists('unslash')) { |
|
19 | + if (!function_exists('unslash')) { |
|
20 | 20 | /** |
21 | 21 | * Remove trailing slashes from the start and end of a string. |
22 | 22 | * |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | if (defined('HYDE_COMPATIBILITY_MODE') && HYDE_COMPATIBILITY_MODE === true) { |
35 | 35 | // Don't declare these functions when running in compatibility mode. |
36 | 36 | } else { |
37 | - if (! function_exists('asset')) { |
|
37 | + if (!function_exists('asset')) { |
|
38 | 38 | /** |
39 | 39 | * Get a relative link or URL to an asset in the media directory. |
40 | 40 | */ |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - if (! function_exists('route')) { |
|
47 | + if (!function_exists('route')) { |
|
48 | 48 | /** |
49 | 49 | * Get a page route by its key. |
50 | 50 | */ |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - if (! function_exists('url')) { |
|
57 | + if (!function_exists('url')) { |
|
58 | 58 | /** |
59 | 59 | * Get a qualified URL to the supplied path if a base URL is set. |
60 | 60 | */ |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | use function trim; |
80 | 80 | use function md5; |
81 | 81 | |
82 | - if (! function_exists('\Hyde\hyde')) { |
|
82 | + if (!function_exists('\Hyde\hyde')) { |
|
83 | 83 | /** |
84 | 84 | * Get the available HydeKernel instance. |
85 | 85 | */ |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - if (! function_exists('\Hyde\unslash')) { |
|
92 | + if (!function_exists('\Hyde\unslash')) { |
|
93 | 93 | /** |
94 | 94 | * Remove trailing slashes from the start and end of a string. |
95 | 95 | */ |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - if (! function_exists('\Hyde\unixsum')) { |
|
102 | + if (!function_exists('\Hyde\unixsum')) { |
|
103 | 103 | /** |
104 | 104 | * A EOL agnostic wrapper for calculating MD5 checksums. |
105 | 105 | * |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - if (! function_exists('\Hyde\unixsum_file')) { |
|
114 | + if (!function_exists('\Hyde\unixsum_file')) { |
|
115 | 115 | /** |
116 | 116 | * Shorthand for {@see unixsum()} but loads a file. |
117 | 117 | */ |
@@ -121,63 +121,63 @@ discard block |
||
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | - if (! function_exists('\Hyde\make_title')) { |
|
124 | + if (!function_exists('\Hyde\make_title')) { |
|
125 | 125 | function make_title(string $value): string |
126 | 126 | { |
127 | 127 | return hyde()->makeTitle($value); |
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - if (! function_exists('\Hyde\normalize_newlines')) { |
|
131 | + if (!function_exists('\Hyde\normalize_newlines')) { |
|
132 | 132 | function normalize_newlines(string $string): string |
133 | 133 | { |
134 | 134 | return hyde()->normalizeNewlines($string); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - if (! function_exists('\Hyde\strip_newlines')) { |
|
138 | + if (!function_exists('\Hyde\strip_newlines')) { |
|
139 | 139 | function strip_newlines(string $string): string |
140 | 140 | { |
141 | 141 | return hyde()->stripNewlines($string); |
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - if (! function_exists('\Hyde\trim_slashes')) { |
|
145 | + if (!function_exists('\Hyde\trim_slashes')) { |
|
146 | 146 | function trim_slashes(string $string): string |
147 | 147 | { |
148 | 148 | return hyde()->trimSlashes($string); |
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - if (! function_exists('\Hyde\evaluate_arrayable')) { |
|
152 | + if (!function_exists('\Hyde\evaluate_arrayable')) { |
|
153 | 153 | function evaluate_arrayable(array|Arrayable $array): array |
154 | 154 | { |
155 | 155 | return $array instanceof Arrayable ? $array->toArray() : $array; |
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - if (! function_exists('\Hyde\yaml_encode')) { |
|
159 | + if (!function_exists('\Hyde\yaml_encode')) { |
|
160 | 160 | function yaml_encode(mixed $input, int $inline = 2, int $indent = 4, int $flags = 0): string |
161 | 161 | { |
162 | 162 | return Yaml::dump($input instanceof Arrayable ? $input->toArray() : $input, $inline, $indent, $flags); |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - if (! function_exists('\Hyde\yaml_decode')) { |
|
166 | + if (!function_exists('\Hyde\yaml_decode')) { |
|
167 | 167 | function yaml_decode(string $input, int $flags = 0): mixed |
168 | 168 | { |
169 | 169 | return Yaml::parse($input, $flags); |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | - if (! function_exists('\Hyde\path_join')) { |
|
173 | + if (!function_exists('\Hyde\path_join')) { |
|
174 | 174 | function path_join(string $directory, string ...$paths): string |
175 | 175 | { |
176 | 176 | return implode('/', array_merge([$directory], $paths)); |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - if (! function_exists('\Hyde\normalize_slashes')) { |
|
180 | + if (!function_exists('\Hyde\normalize_slashes')) { |
|
181 | 181 | function normalize_slashes(string $string): string |
182 | 182 | { |
183 | 183 | return str_replace('\\', '/', $string); |
@@ -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 |