@@ -21,7 +21,7 @@ |
||
21 | 21 | $resolver = new EngineResolver(); |
22 | 22 | $filesystem = new Filesystem(); |
23 | 23 | |
24 | - $resolver->register('blade', function () use ($filesystem) { |
|
24 | + $resolver->register('blade', function() use ($filesystem) { |
|
25 | 25 | return new CompilerEngine( |
26 | 26 | new BladeCompiler($filesystem, sys_get_temp_dir()) |
27 | 27 | ); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | public static function mockWindowsOs(bool $isWindowsOs): void |
31 | 31 | { |
32 | - static::$enableLaravelPrompts = ! $isWindowsOs; |
|
32 | + static::$enableLaravelPrompts = !$isWindowsOs; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public static function canUseLaravelPrompts(InputInterface $input): bool |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /** @return array<string, string> */ |
29 | 29 | public function getFileChoices(): array |
30 | 30 | { |
31 | - return Arr::mapWithKeys($this->publishableFilesMap, /** @return array<string, string> */ function (string $target, string $source): array { |
|
31 | + return Arr::mapWithKeys($this->publishableFilesMap, /** @return array<string, string> */ function(string $target, string $source): array { |
|
32 | 32 | return [$source => $this->pathRelativeToDirectory($source, $this->getBaseDirectory())]; |
33 | 33 | }); |
34 | 34 | } |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | /** Find the most specific common parent directory path for the files, trimming as much as possible whilst keeping specificity and uniqueness. */ |
47 | 47 | public function getBaseDirectory(): string |
48 | 48 | { |
49 | - $partsMap = collect($this->publishableFilesMap)->map(function (string $file): array { |
|
49 | + $partsMap = collect($this->publishableFilesMap)->map(function(string $file): array { |
|
50 | 50 | return explode('/', $file); |
51 | 51 | }); |
52 | 52 | |
53 | - $commonParts = $partsMap->reduce(function (array $carry, array $parts): array { |
|
53 | + $commonParts = $partsMap->reduce(function(array $carry, array $parts): array { |
|
54 | 54 | return array_intersect($carry, $parts); |
55 | 55 | }, $partsMap->first()); |
56 | 56 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->infoComment(sprintf('Selected group [%s]', $selected)); |
47 | 47 | } |
48 | 48 | |
49 | - if (! in_array($selected, $allowed = array_merge(['all'], array_keys($this->options)), true)) { |
|
49 | + if (!in_array($selected, $allowed = array_merge(['all'], array_keys($this->options)), true)) { |
|
50 | 50 | $this->error("Invalid selection: '$selected'"); |
51 | 51 | $this->infoComment('Allowed values are: ['.implode(', ', $allowed).']'); |
52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | $files = $selected === 'all' |
57 | - ? collect($this->options)->flatMap(fn (ViewPublishGroup $option): array => $option->publishableFilesMap())->all() |
|
57 | + ? collect($this->options)->flatMap(fn (ViewPublishGroup $option) : array => $option->publishableFilesMap())->all() |
|
58 | 58 | : $this->options[$selected]->publishableFilesMap(); |
59 | 59 | |
60 | 60 | $publisher = $this->publishSelectedFiles($files, $selected === 'all'); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function promptForGroup(): string |
68 | 68 | { |
69 | - SelectPrompt::fallbackUsing(function (SelectPrompt $prompt): string { |
|
69 | + SelectPrompt::fallbackUsing(function(SelectPrompt $prompt): string { |
|
70 | 70 | return $this->choice($prompt->label, $prompt->options, $prompt->default); |
71 | 71 | }); |
72 | 72 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | protected static function mapToKeys(array $groups): array |
97 | 97 | { |
98 | - return collect($groups)->mapWithKeys(function (ViewPublishGroup $group): array { |
|
98 | + return collect($groups)->mapWithKeys(function(ViewPublishGroup $group): array { |
|
99 | 99 | return [Str::after($group->group, 'hyde-') => $group]; |
100 | 100 | })->all(); |
101 | 101 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $publisher = new InteractivePublishCommandHelper($files); |
107 | 107 | |
108 | - if (! $isPublishingAll && ConsoleHelper::canUseLaravelPrompts($this->input)) { |
|
108 | + if (!$isPublishingAll && ConsoleHelper::canUseLaravelPrompts($this->input)) { |
|
109 | 109 | $publisher->only($this->promptUserForWhichFilesToPublish($publisher->getFileChoices())); |
110 | 110 | } |
111 | 111 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | protected static function supportTogglingAll(MultiSelectPrompt $prompt): Closure |
133 | 133 | { |
134 | - return function (string $key) use ($prompt): void { |
|
134 | + return function(string $key) use ($prompt): void { |
|
135 | 135 | static $isToggled = false; |
136 | 136 | |
137 | 137 | if ($prompt->isHighlighted('all')) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $isToggled = true; |
147 | 147 | } |
148 | 148 | } elseif ($key === Key::ENTER) { |
149 | - if (! $isToggled) { |
|
149 | + if (!$isToggled) { |
|
150 | 150 | $prompt->emit('key', Key::CTRL_A); |
151 | 151 | } |
152 | 152 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | protected function getEnvironmentVariables(): array |
97 | 97 | { |
98 | 98 | return Arr::whereNotNull([ |
99 | - 'HYDE_SERVER_REQUEST_OUTPUT' => ! $this->option('no-ansi'), |
|
99 | + 'HYDE_SERVER_REQUEST_OUTPUT' => !$this->option('no-ansi'), |
|
100 | 100 | 'HYDE_SERVER_SAVE_PREVIEW' => $this->parseEnvironmentOption('save-preview'), |
101 | 101 | 'HYDE_SERVER_DASHBOARD' => $this->parseEnvironmentOption('dashboard'), |
102 | 102 | 'HYDE_PRETTY_URLS' => $this->parseEnvironmentOption('pretty-urls'), |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | protected function configureOutput(): void |
108 | 108 | { |
109 | - if (! $this->useBasicOutput()) { |
|
109 | + if (!$this->useBasicOutput()) { |
|
110 | 110 | $this->console = new ConsoleOutput($this->output->isVerbose()); |
111 | 111 | } |
112 | 112 | } |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | |
121 | 121 | protected function getOutputHandler(): Closure |
122 | 122 | { |
123 | - return $this->useBasicOutput() ? function (string $type, string $line): void { |
|
123 | + return $this->useBasicOutput() ? function(string $type, string $line): void { |
|
124 | 124 | $this->output->write($line); |
125 | 125 | } : $this->console->getFormatter(); |
126 | 126 | } |
127 | 127 | |
128 | 128 | protected function useBasicOutput(): bool |
129 | 129 | { |
130 | - return $this->option('no-ansi') || ! class_exists(ConsoleOutput::class); |
|
130 | + return $this->option('no-ansi') || !class_exists(ConsoleOutput::class); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | protected function parseEnvironmentOption(string $name): ?string |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | $process = $binary ? Process::command($command)->run() : null; |
168 | 168 | |
169 | - if (! $process || $process->failed()) { |
|
169 | + if (!$process || $process->failed()) { |
|
170 | 170 | $this->warn('Unable to open the site preview in the browser on your system:'); |
171 | 171 | $this->line(sprintf(' %s', str_replace("\n", "\n ", $process ? $process->errorOutput() : "Missing suitable 'open' binary."))); |
172 | 172 | $this->newLine(); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | protected function runViteProcess(): void |
187 | 187 | { |
188 | - if (! $this->isPortAvailable(5173)) { |
|
188 | + if (!$this->isPortAvailable(5173)) { |
|
189 | 189 | throw new InvalidArgumentException( |
190 | 190 | 'Unable to start Vite server: Port 5173 is already in use. '. |
191 | 191 | 'Please stop any other Vite processes and try again.' |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | while ($this->server->running()) { |
203 | 203 | $this->handleViteOutput(); |
204 | 204 | |
205 | - Sleep::for(100)->milliseconds(); |
|
205 | + Sleep::for (100)->milliseconds(); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 |
@@ -202,7 +202,9 @@ |
||
202 | 202 | while ($this->server->running()) { |
203 | 203 | $this->handleViteOutput(); |
204 | 204 | |
205 | - Sleep::for(100)->milliseconds(); |
|
205 | + Sleep::for(100) { |
|
206 | + ->milliseconds(); |
|
207 | + } |
|
206 | 208 | } |
207 | 209 | } |
208 | 210 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | /** Translates a case name into the corresponding Enum case, if any. If there is no matching case defined, it will return null. */ |
32 | 32 | public static function fromName(string $name): ?self |
33 | 33 | { |
34 | - if (! defined("self::$name")) { |
|
34 | + if (!defined("self::$name")) { |
|
35 | 35 | return null; |
36 | 36 | } |
37 | 37 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | /** This method is used to inject the project's Tailwind CSS configuration into the Play CDN integration so it can match the styles. */ |
42 | 42 | public static function injectTailwindConfig(): string |
43 | 43 | { |
44 | - if (! file_exists(Hyde::path('tailwind.config.js'))) { |
|
44 | + if (!file_exists(Hyde::path('tailwind.config.js'))) { |
|
45 | 45 | return ''; |
46 | 46 | } |
47 | 47 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Hyde\Foundation\HydeKernel; |
7 | 7 | use Hyde\Support\Filesystem\MediaFile; |
8 | 8 | |
9 | - if (! function_exists('hyde')) { |
|
9 | + if (!function_exists('hyde')) { |
|
10 | 10 | /** |
11 | 11 | * Get the available HydeKernel instance. |
12 | 12 | */ |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | if (defined('HYDE_COMPATIBILITY_MODE') && HYDE_COMPATIBILITY_MODE === true) { |
20 | 20 | // Don't declare these functions when running in compatibility mode. |
21 | 21 | } else { |
22 | - if (! function_exists('asset')) { |
|
22 | + if (!function_exists('asset')) { |
|
23 | 23 | /** |
24 | 24 | * Gets a MediaAsset instance for the given file stored in the `_site/media` folder. |
25 | 25 | * The returned value can be cast into a string in Blade views to resole the URL. |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | - if (! function_exists('route')) { |
|
38 | + if (!function_exists('route')) { |
|
39 | 39 | /** |
40 | 40 | * Get a page route instance by its key. Casting it to a string will return a relative link to the page. |
41 | 41 | */ |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - if (! function_exists('url')) { |
|
48 | + if (!function_exists('url')) { |
|
49 | 49 | /** |
50 | 50 | * Get a qualified URL to the supplied path if a base URL is set. |
51 | 51 | */ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | use function trim; |
71 | 71 | use function md5; |
72 | 72 | |
73 | - if (! function_exists('\Hyde\hyde')) { |
|
73 | + if (!function_exists('\Hyde\hyde')) { |
|
74 | 74 | /** |
75 | 75 | * Get the available HydeKernel instance. |
76 | 76 | */ |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - if (! function_exists('\Hyde\unslash')) { |
|
83 | + if (!function_exists('\Hyde\unslash')) { |
|
84 | 84 | /** |
85 | 85 | * Remove trailing slashes from the start and end of a string. |
86 | 86 | */ |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - if (! function_exists('\Hyde\unixsum')) { |
|
93 | + if (!function_exists('\Hyde\unixsum')) { |
|
94 | 94 | /** |
95 | 95 | * A EOL agnostic wrapper for calculating MD5 checksums. |
96 | 96 | * |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - if (! function_exists('\Hyde\unixsum_file')) { |
|
105 | + if (!function_exists('\Hyde\unixsum_file')) { |
|
106 | 106 | /** |
107 | 107 | * Shorthand for {@see unixsum()} but loads a file. |
108 | 108 | */ |
@@ -112,63 +112,63 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - if (! function_exists('\Hyde\make_title')) { |
|
115 | + if (!function_exists('\Hyde\make_title')) { |
|
116 | 116 | function make_title(string $value): string |
117 | 117 | { |
118 | 118 | return hyde()->makeTitle($value); |
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | - if (! function_exists('\Hyde\normalize_newlines')) { |
|
122 | + if (!function_exists('\Hyde\normalize_newlines')) { |
|
123 | 123 | function normalize_newlines(string $string): string |
124 | 124 | { |
125 | 125 | return hyde()->normalizeNewlines($string); |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - if (! function_exists('\Hyde\strip_newlines')) { |
|
129 | + if (!function_exists('\Hyde\strip_newlines')) { |
|
130 | 130 | function strip_newlines(string $string): string |
131 | 131 | { |
132 | 132 | return hyde()->stripNewlines($string); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - if (! function_exists('\Hyde\trim_slashes')) { |
|
136 | + if (!function_exists('\Hyde\trim_slashes')) { |
|
137 | 137 | function trim_slashes(string $string): string |
138 | 138 | { |
139 | 139 | return hyde()->trimSlashes($string); |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - if (! function_exists('\Hyde\evaluate_arrayable')) { |
|
143 | + if (!function_exists('\Hyde\evaluate_arrayable')) { |
|
144 | 144 | function evaluate_arrayable(array|Arrayable $array): array |
145 | 145 | { |
146 | 146 | return $array instanceof Arrayable ? $array->toArray() : $array; |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - if (! function_exists('\Hyde\yaml_encode')) { |
|
150 | + if (!function_exists('\Hyde\yaml_encode')) { |
|
151 | 151 | function yaml_encode(mixed $input, int $inline = 2, int $indent = 4, int $flags = 0): string |
152 | 152 | { |
153 | 153 | return Yaml::dump($input instanceof Arrayable ? $input->toArray() : $input, $inline, $indent, $flags); |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - if (! function_exists('\Hyde\yaml_decode')) { |
|
157 | + if (!function_exists('\Hyde\yaml_decode')) { |
|
158 | 158 | function yaml_decode(string $input, int $flags = 0): mixed |
159 | 159 | { |
160 | 160 | return Yaml::parse($input, $flags); |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - if (! function_exists('\Hyde\path_join')) { |
|
164 | + if (!function_exists('\Hyde\path_join')) { |
|
165 | 165 | function path_join(string $directory, string ...$paths): string |
166 | 166 | { |
167 | 167 | return implode('/', array_merge([$directory], $paths)); |
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - if (! function_exists('\Hyde\normalize_slashes')) { |
|
171 | + if (!function_exists('\Hyde\normalize_slashes')) { |
|
172 | 172 | function normalize_slashes(string $string): string |
173 | 173 | { |
174 | 174 | return str_replace('\\', '/', $string); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $value = Config::getNullableString('hyde.url'); |
110 | 110 | |
111 | - return ! blank($value) && $value !== 'http://localhost'; |
|
111 | + return !blank($value) && $value !== 'http://localhost'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | // Since v1.7.0, we return the relative path even if the base URL is not set, |
135 | 135 | // as this is more likely to be the desired behavior the user's expecting. |
136 | - if (! blank($path)) { |
|
136 | + if (!blank($path)) { |
|
137 | 137 | return $path; |
138 | 138 | } |
139 | 139 |