@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function compileStaticPages(): void |
45 | 45 | { |
46 | - collect($this->getPageTypes())->each(function (string $pageClass): void { |
|
46 | + collect($this->getPageTypes())->each(function(string $pageClass): void { |
|
47 | 47 | $this->compilePagesForClass($pageClass); |
48 | 48 | }); |
49 | 49 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->needsDirectory(Hyde::siteMediaPath()); |
54 | 54 | |
55 | 55 | $this->comment('Transferring Media Assets...'); |
56 | - $this->withProgressBar(MediaFile::files(), function (string $identifier): void { |
|
56 | + $this->withProgressBar(MediaFile::files(), function(string $identifier): void { |
|
57 | 57 | $sitePath = Hyde::siteMediaPath($identifier); |
58 | 58 | $this->needsParentDirectory($sitePath); |
59 | 59 | copy(Hyde::mediaPath($identifier), $sitePath); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $collection = Routes::getRoutes($pageClass); |
73 | 73 | |
74 | - $this->withProgressBar($collection, function (Route $route): void { |
|
74 | + $this->withProgressBar($collection, function(Route $route): void { |
|
75 | 75 | StaticPageBuilder::handle($route->getPage()); |
76 | 76 | }); |
77 | 77 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** @return array<class-string<\Hyde\Pages\Concerns\HydePage>> */ |
87 | 87 | protected function getPageTypes(): array |
88 | 88 | { |
89 | - return Hyde::pages()->map(function (HydePage $page): string { |
|
89 | + return Hyde::pages()->map(function(HydePage $page): string { |
|
90 | 90 | return $page::class; |
91 | 91 | })->unique()->values()->toArray(); |
92 | 92 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | public static function enabled(): bool |
50 | 50 | { |
51 | - return Config::getBool('docs.create_search_page', true) && ! Hyde::routes()->has(self::routeKey()); |
|
51 | + return Config::getBool('docs.create_search_page', true) && !Hyde::routes()->has(self::routeKey()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public static function routeKey(): string |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | /** @return array<string, DropdownNavItem> */ |
32 | 32 | public function getDropdowns(): array |
33 | 33 | { |
34 | - if (! $this->dropdownsEnabled()) { |
|
34 | + if (!$this->dropdownsEnabled()) { |
|
35 | 35 | throw new BadMethodCallException('Dropdowns are not enabled. Enable it by setting `hyde.navigation.subdirectories` to `dropdown`.'); |
36 | 36 | } |
37 | 37 | |
38 | - return $this->items->filter(function (NavItem $item): bool { |
|
38 | + return $this->items->filter(function(NavItem $item): bool { |
|
39 | 39 | return $item instanceof DropdownNavItem; |
40 | 40 | })->values()->all(); |
41 | 41 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | protected function canAddRoute(Route $route): bool |
64 | 64 | { |
65 | - return parent::canAddRoute($route) && (! $route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName())); |
|
65 | + return parent::canAddRoute($route) && (!$route->getPage() instanceof DocumentationPage || $route->is(DocumentationPage::homeRouteName())); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | protected function canAddItemToDropdown(NavItem $item): bool |
@@ -14,8 +14,8 @@ |
||
14 | 14 | { |
15 | 15 | public const NAVIGATION_SCHEMA = [ |
16 | 16 | 'label' => 'string', // The text to display |
17 | - 'priority' => 'int', // Order is also supported |
|
18 | - 'hidden' => 'bool', // Visible is also supported (but obviously invert the value) |
|
17 | + 'priority' => 'int', // Order is also supported |
|
18 | + 'hidden' => 'bool', // Visible is also supported (but obviously invert the value) |
|
19 | 19 | 'group' => 'string', // Category is also supported |
20 | 20 | ]; |
21 | 21 | } |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | |
12 | 12 | define('BASE_PATH', realpath(__DIR__.'/../../../')); |
13 | 13 | |
14 | -if (BASE_PATH === false || ! file_exists(BASE_PATH.'/hyde')) { |
|
14 | +if (BASE_PATH === false || !file_exists(BASE_PATH.'/hyde')) { |
|
15 | 15 | throw new InvalidArgumentException('This test suite must be run from the root of the hydephp/develop monorepo.'); |
16 | 16 | } |
17 | 17 | |
18 | 18 | ob_start(); |
19 | 19 | |
20 | -test('handle routes index page', function () { |
|
20 | +test('handle routes index page', function() { |
|
21 | 21 | putenv('SERVER_DASHBOARD=false'); |
22 | 22 | mockRoute(''); |
23 | 23 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | Filesystem::unlink('_site/index.html'); |
37 | 37 | }); |
38 | 38 | |
39 | -test('handle routes custom pages', function () { |
|
39 | +test('handle routes custom pages', function() { |
|
40 | 40 | mockRoute('foo'); |
41 | 41 | |
42 | 42 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | Filesystem::unlink('_site/foo.html'); |
55 | 55 | }); |
56 | 56 | |
57 | -test('handle routes pages with .html extension', function () { |
|
57 | +test('handle routes pages with .html extension', function() { |
|
58 | 58 | mockRoute('foo.html'); |
59 | 59 | |
60 | 60 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | Filesystem::unlink('_site/foo.html'); |
73 | 73 | }); |
74 | 74 | |
75 | -test('handle routes static assets', function () { |
|
75 | +test('handle routes static assets', function() { |
|
76 | 76 | mockRoute('media/app.css'); |
77 | 77 | |
78 | 78 | $kernel = new HttpKernel(); |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | expect($response->body)->toContain('/*! HydeFront v3.0.0'); |
86 | 86 | }); |
87 | 87 | |
88 | -test('handle throws route not found exception for missing route', function () { |
|
88 | +test('handle throws route not found exception for missing route', function() { |
|
89 | 89 | mockRoute('missing'); |
90 | 90 | |
91 | 91 | $kernel = new HttpKernel(); |
92 | 92 | $kernel->handle(new Request()); |
93 | 93 | })->throws(RouteNotFoundException::class, 'Route [missing] not found'); |
94 | 94 | |
95 | -test('handle sends 404 error response for missing asset', function () { |
|
95 | +test('handle sends 404 error response for missing asset', function() { |
|
96 | 96 | mockRoute('missing.css'); |
97 | 97 | |
98 | 98 | $kernel = new HttpKernel(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // Filesystem::unlink('_site/foo.html'); |
124 | 124 | //})->skip('Underlying framework does not buffer headers (yet)'); |
125 | 125 | |
126 | -test('trailing slashes are normalized from route', function () { |
|
126 | +test('trailing slashes are normalized from route', function() { |
|
127 | 127 | mockRoute('foo/'); |
128 | 128 | |
129 | 129 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | Filesystem::unlink('_site/foo.html'); |
142 | 142 | }); |
143 | 143 | |
144 | -test('docs uri path is rerouted to docs/index', function () { |
|
144 | +test('docs uri path is rerouted to docs/index', function() { |
|
145 | 145 | mockRoute('docs'); |
146 | 146 | |
147 | 147 | Filesystem::put('_docs/index.md', '# Hello World!'); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | Filesystem::unlink('_site/docs/index.html'); |
160 | 160 | }); |
161 | 161 | |
162 | -test('docs/search renders search page', function () { |
|
162 | +test('docs/search renders search page', function() { |
|
163 | 163 | mockRoute('docs/search'); |
164 | 164 | |
165 | 165 | $kernel = new HttpKernel(); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | Filesystem::unlink('_site/docs/search.html'); |
175 | 175 | }); |
176 | 176 | |
177 | -test('ping route returns ping response', function () { |
|
177 | +test('ping route returns ping response', function() { |
|
178 | 178 | mockRoute('ping'); |
179 | 179 | |
180 | 180 | $kernel = new HttpKernel(); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | ->and($response->statusMessage)->toBe('OK'); |
186 | 186 | }); |
187 | 187 | |
188 | -test('exception handling', function () { |
|
188 | +test('exception handling', function() { |
|
189 | 189 | $exception = new Exception('foo'); |
190 | 190 | $response = ExceptionHandler::handle($exception); |
191 | 191 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** @return \Hyde\Foundation\Kernel\PageCollection<\Hyde\Pages\MarkdownPost> */ |
36 | 36 | public static function getLatestPosts(): PageCollection |
37 | 37 | { |
38 | - return static::all()->sortByDesc(function (self $post): int { |
|
38 | + return static::all()->sortByDesc(function(self $post): int { |
|
39 | 39 | return $post->date?->dateTimeObject->getTimestamp() ?? 0; |
40 | 40 | }); |
41 | 41 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function files(): array |
135 | 135 | { |
136 | - return Files::getFiles(static::class)->map(function (SourceFile $file): string { |
|
136 | + return Files::getFiles(static::class)->map(function(SourceFile $file): string { |
|
137 | 137 | return static::pathToIdentifier($file->getPath()); |
138 | 138 | })->values()->toArray(); |
139 | 139 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function showInNavigation(): bool |
373 | 373 | { |
374 | - return ! $this->navigation->hidden; |
|
374 | + return !$this->navigation->hidden; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | |
401 | 401 | public function getCanonicalUrl(): ?string |
402 | 402 | { |
403 | - if (! empty($this->matter('canonicalUrl'))) { |
|
403 | + if (!empty($this->matter('canonicalUrl'))) { |
|
404 | 404 | return $this->matter('canonicalUrl'); |
405 | 405 | } |
406 | 406 | |
407 | - if (Hyde::hasSiteUrl() && ! empty($this->identifier)) { |
|
407 | + if (Hyde::hasSiteUrl() && !empty($this->identifier)) { |
|
408 | 408 | return Hyde::url($this->getOutputPath()); |
409 | 409 | } |
410 | 410 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | $app = Container::getInstance(); |
27 | 27 | |
28 | - if (! $app->bound(self::class)) { |
|
28 | + if (!$app->bound(self::class)) { |
|
29 | 29 | $app->singleton(self::class); |
30 | 30 | } |
31 | 31 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | namespace { |
6 | 6 | use Hyde\Foundation\HydeKernel; |
7 | 7 | |
8 | - if (! function_exists('hyde')) { |
|
8 | + if (!function_exists('hyde')) { |
|
9 | 9 | /** |
10 | 10 | * Get the available HydeKernel instance. |
11 | 11 | */ |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | - if (! function_exists('unslash')) { |
|
18 | + if (!function_exists('unslash')) { |
|
19 | 19 | /** |
20 | 20 | * Remove trailing slashes from the start and end of a string. |
21 | 21 | */ |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | use function trim; |
40 | 40 | use function md5; |
41 | 41 | |
42 | - if (! function_exists('\Hyde\hyde')) { |
|
42 | + if (!function_exists('\Hyde\hyde')) { |
|
43 | 43 | /** |
44 | 44 | * Get the available HydeKernel instance. |
45 | 45 | */ |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - if (! function_exists('\Hyde\unslash')) { |
|
52 | + if (!function_exists('\Hyde\unslash')) { |
|
53 | 53 | /** |
54 | 54 | * Remove trailing slashes from the start and end of a string. |
55 | 55 | */ |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - if (! function_exists('\Hyde\unixsum')) { |
|
62 | + if (!function_exists('\Hyde\unixsum')) { |
|
63 | 63 | /** |
64 | 64 | * A EOL agnostic wrapper for calculating MD5 checksums. |
65 | 65 | * |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | - if (! function_exists('\Hyde\unixsum_file')) { |
|
74 | + if (!function_exists('\Hyde\unixsum_file')) { |
|
75 | 75 | /** |
76 | 76 | * Shorthand for {@see unixsum()} but loads a file. |
77 | 77 | */ |
@@ -81,63 +81,63 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - if (! function_exists('\Hyde\make_title')) { |
|
84 | + if (!function_exists('\Hyde\make_title')) { |
|
85 | 85 | function make_title(string $value): string |
86 | 86 | { |
87 | 87 | return hyde()->makeTitle($value); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - if (! function_exists('\Hyde\normalize_newlines')) { |
|
91 | + if (!function_exists('\Hyde\normalize_newlines')) { |
|
92 | 92 | function normalize_newlines(string $string): string |
93 | 93 | { |
94 | 94 | return hyde()->normalizeNewlines($string); |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - if (! function_exists('\Hyde\strip_newlines')) { |
|
98 | + if (!function_exists('\Hyde\strip_newlines')) { |
|
99 | 99 | function strip_newlines(string $string): string |
100 | 100 | { |
101 | 101 | return hyde()->stripNewlines($string); |
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - if (! function_exists('\Hyde\trim_slashes')) { |
|
105 | + if (!function_exists('\Hyde\trim_slashes')) { |
|
106 | 106 | function trim_slashes(string $string): string |
107 | 107 | { |
108 | 108 | return hyde()->trimSlashes($string); |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - if (! function_exists('\Hyde\evaluate_arrayable')) { |
|
112 | + if (!function_exists('\Hyde\evaluate_arrayable')) { |
|
113 | 113 | function evaluate_arrayable(array|Arrayable $array): array |
114 | 114 | { |
115 | 115 | return $array instanceof Arrayable ? $array->toArray() : $array; |
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - if (! function_exists('\Hyde\yaml_encode')) { |
|
119 | + if (!function_exists('\Hyde\yaml_encode')) { |
|
120 | 120 | function yaml_encode(mixed $input, int $inline = 2, int $indent = 4, int $flags = 0): string |
121 | 121 | { |
122 | 122 | return Yaml::dump($input instanceof Arrayable ? $input->toArray() : $input, $inline, $indent, $flags); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if (! function_exists('\Hyde\yaml_decode')) { |
|
126 | + if (!function_exists('\Hyde\yaml_decode')) { |
|
127 | 127 | function yaml_decode(string $input, int $flags = 0): mixed |
128 | 128 | { |
129 | 129 | return Yaml::parse($input, $flags); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - if (! function_exists('\Hyde\path_join')) { |
|
133 | + if (!function_exists('\Hyde\path_join')) { |
|
134 | 134 | function path_join(string $directory, string ...$paths): string |
135 | 135 | { |
136 | 136 | return implode('/', array_merge([$directory], $paths)); |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if (! function_exists('\Hyde\normalize_slashes')) { |
|
140 | + if (!function_exists('\Hyde\normalize_slashes')) { |
|
141 | 141 | function normalize_slashes(string $string): string |
142 | 142 | { |
143 | 143 | return str_replace('\\', '/', $string); |