@@ -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 app; |
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); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** Get all the configuration files for the application. */ |
20 | 20 | protected function getConfigurationFiles(Application $app): array |
21 | 21 | { |
22 | - return tap(parent::getConfigurationFiles($app), function (array &$files) use ($app): void { |
|
22 | + return tap(parent::getConfigurationFiles($app), function(array &$files) use ($app): void { |
|
23 | 23 | // Inject our custom config file which is stored in `app/config.php`. |
24 | 24 | $files['app'] = $app->basePath().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'config.php'; |
25 | 25 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // If we're running in a Phar and no project config directory exists, |
68 | 68 | // we need to adjust the path to use the bundled static Phar config file. |
69 | 69 | |
70 | - if (Phar::running() && (! is_dir($files['app']))) { |
|
70 | + if (Phar::running() && (!is_dir($files['app']))) { |
|
71 | 71 | $files['app'] = dirname(__DIR__, 6).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; |
72 | 72 | } |
73 | 73 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function mediaLink(string $destination, bool $validate = false): string |
91 | 91 | { |
92 | - if ($validate && ! file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) { |
|
92 | + if ($validate && !file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) { |
|
93 | 93 | throw new FileNotFoundException($sourcePath); |
94 | 94 | } |
95 | 95 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function hasSiteUrl(): bool |
125 | 125 | { |
126 | - return ! blank(Config::getNullableString('hyde.url')); |
|
126 | + return !blank(Config::getNullableString('hyde.url')); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public function check_documentation_site_has_an_index_page(Result $result): Result |
77 | 77 | { |
78 | - if (! Features::hasDocumentationPages()) { |
|
78 | + if (!Features::hasDocumentationPages()) { |
|
79 | 79 | return $result->skip('Does documentation site have an index page?') |
80 | 80 | ->withTip('Skipped because: The documentation page feature is disabled in config'); |
81 | 81 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | public function check_a_torchlight_api_token_is_set(Result $result): Result |
123 | 123 | { |
124 | - if (! Features::enabled(Features::torchlight())) { |
|
124 | + if (!Features::enabled(Features::torchlight())) { |
|
125 | 125 | return $result->skip('Check a Torchlight API token is set') |
126 | 126 | ->withTip('Torchlight is an API for code syntax highlighting. You can enable it in the Hyde config.'); |
127 | 127 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function addExtension(string $extensionClassName): void |
89 | 89 | { |
90 | - if (! in_array($extensionClassName, $this->extensions)) { |
|
90 | + if (!in_array($extensionClassName, $this->extensions)) { |
|
91 | 91 | $this->extensions[] = $extensionClassName; |
92 | 92 | } |
93 | 93 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | public function addFeature(string $feature): static |
130 | 130 | { |
131 | - if (! in_array($feature, $this->features)) { |
|
131 | + if (!in_array($feature, $this->features)) { |
|
132 | 132 | $this->features[] = $feature; |
133 | 133 | } |
134 | 134 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | protected function determineIfTorchlightAttributionShouldBeInjected(): bool |
182 | 182 | { |
183 | - return ! $this->isDocumentationPage() |
|
183 | + return !$this->isDocumentationPage() |
|
184 | 184 | && Config::getBool('torchlight.attribution.enabled', true) |
185 | 185 | && str_contains($this->html, 'Syntax highlighted by torchlight.dev'); |
186 | 186 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $selected = $this->parseSelection(); |
56 | 56 | |
57 | - if (! $this->canExistingFileBeOverwritten()) { |
|
57 | + if (!$this->canExistingFileBeOverwritten()) { |
|
58 | 58 | $this->error('A modified index.blade.php file already exists. Use --force to overwrite.'); |
59 | 59 | |
60 | 60 | return 409; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | Artisan::call('vendor:publish', [ |
66 | 66 | '--tag' => $this->options[$selected]['group'] ?? $selected, |
67 | 67 | '--force' => true, // Todo add force state dynamically depending on existing file state |
68 | - ], ! $tagExists ? $this->output : null); |
|
68 | + ], !$tagExists ? $this->output : null); |
|
69 | 69 | |
70 | 70 | if ($tagExists) { |
71 | 71 | $this->infoComment("Published page [$selected]"); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function formatPublishableChoices(): array |
94 | 94 | { |
95 | - return $this->getTemplateOptions()->map(function (array $option, string $key): string { |
|
95 | + return $this->getTemplateOptions()->map(function(array $option, string $key): string { |
|
96 | 96 | return "<comment>$key</comment>: {$option['description']}"; |
97 | 97 | })->values()->toArray(); |
98 | 98 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return true; |
114 | 114 | } |
115 | 115 | |
116 | - if (! file_exists(BladePage::path('index.blade.php'))) { |
|
116 | + if (!file_exists(BladePage::path('index.blade.php'))) { |
|
117 | 117 | return true; |
118 | 118 | } |
119 | 119 |
@@ -93,11 +93,11 @@ |
||
93 | 93 | Hyde::pathToRelative(DocumentationPage::path()), |
94 | 94 | ]; |
95 | 95 | |
96 | - if (! in_array($directory, $directories)) { |
|
96 | + if (!in_array($directory, $directories)) { |
|
97 | 97 | throw new Exception("Path [$this->path] is not in a valid source directory.", 400); |
98 | 98 | } |
99 | 99 | |
100 | - if (! file_exists(Hyde::path($this->path))) { |
|
100 | + if (!file_exists(Hyde::path($this->path))) { |
|
101 | 101 | throw new Exception("File [$this->path] not found.", 404); |
102 | 102 | } |
103 | 103 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | protected function runDiscovery(): void |
34 | 34 | { |
35 | - $this->kernel->files()->each(function (SourceFile $file): void { |
|
35 | + $this->kernel->files()->each(function(SourceFile $file): void { |
|
36 | 36 | $this->addPage($this->parsePage($file->pageClass, $file->getPath())); |
37 | 37 | }); |
38 | 38 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
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 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public static function files(): array |
128 | 128 | { |
129 | - return Files::getFiles(static::class)->map(function (SourceFile $file): string { |
|
129 | + return Files::getFiles(static::class)->map(function(SourceFile $file): string { |
|
130 | 130 | return static::pathToIdentifier($file->getPath()); |
131 | 131 | })->values()->toArray(); |
132 | 132 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | |
364 | 364 | public function showInNavigation(): bool |
365 | 365 | { |
366 | - return ! $this->navigation->hidden; |
|
366 | + return !$this->navigation->hidden; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | public function navigationMenuPriority(): int |