@@ -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 | } |
@@ -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 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | /** @var Repository $config */ |
39 | 39 | $config = $app->make('config'); |
40 | 40 | |
41 | - tap($config, function (Repository $config): void { |
|
41 | + tap($config, function(Repository $config): void { |
|
42 | 42 | $this->config = $config->all(); |
43 | 43 | $this->mergeParsedConfiguration(); |
44 | 44 | })->set($this->config); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function runDiscovery(): void |
37 | 37 | { |
38 | - $this->kernel->files()->each(function (SourceFile $file): void { |
|
38 | + $this->kernel->files()->each(function(SourceFile $file): void { |
|
39 | 39 | $this->addPage($this->parsePage($file->pageClass, $file->getPath())); |
40 | 40 | }); |
41 | 41 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** @param class-string<\Hyde\Pages\Concerns\HydePage>|null $pageClass */ |
63 | 63 | public function getPages(?string $pageClass = null): PageCollection |
64 | 64 | { |
65 | - return $pageClass ? $this->filter(function (HydePage $page) use ($pageClass): bool { |
|
65 | + return $pageClass ? $this->filter(function(HydePage $page) use ($pageClass) : bool { |
|
66 | 66 | return $page instanceof $pageClass; |
67 | 67 | }) : $this; |
68 | 68 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | // Scan the source directory, and directories therein, for files that match the model's file extension. |
62 | 62 | foreach (glob($this->kernel->path($pageClass::sourcePath('{*,**/*}')), GLOB_BRACE) as $path) { |
63 | - if (! str_starts_with(basename((string) $path), '_')) { |
|
63 | + if (!str_starts_with(basename((string) $path), '_')) { |
|
64 | 64 | $this->addFile(SourceFile::make($path, $pageClass)); |
65 | 65 | } |
66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** @param class-string<\Hyde\Pages\Concerns\HydePage>|null $pageClass */ |
75 | 75 | public function getFiles(?string $pageClass = null): FileCollection |
76 | 76 | { |
77 | - return $pageClass ? $this->filter(function (SourceFile $file) use ($pageClass): bool { |
|
77 | + return $pageClass ? $this->filter(function(SourceFile $file) use ($pageClass) : bool { |
|
78 | 78 | return $file->pageClass === $pageClass; |
79 | 79 | }) : $this; |
80 | 80 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | protected function runDiscovery(): void |
38 | 38 | { |
39 | - $this->kernel->pages()->each(function (HydePage $page): void { |
|
39 | + $this->kernel->pages()->each(function(HydePage $page): void { |
|
40 | 40 | $this->addRoute(new Route($page)); |
41 | 41 | }); |
42 | 42 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** @param class-string<\Hyde\Pages\Concerns\HydePage>|null $pageClass */ |
57 | 57 | public function getRoutes(?string $pageClass = null): RouteCollection |
58 | 58 | { |
59 | - return $pageClass ? $this->filter(function (Route $route) use ($pageClass): bool { |
|
59 | + return $pageClass ? $this->filter(function(Route $route) use ($pageClass) : bool { |
|
60 | 60 | return $route->getPage() instanceof $pageClass; |
61 | 61 | }) : $this; |
62 | 62 | } |
@@ -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 instance by its key. Casting it to a string will return a relative link to the page. |
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); |