@@ -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 | |
@@ -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 | |
@@ -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 | |
@@ -50,8 +50,8 @@ |
||
| 50 | 50 | |
| 51 | 51 | protected function parseConfigurationAuthors(Collection $authors): Collection |
| 52 | 52 | { |
| 53 | - return $authors->mapWithKeys(function (array $author, string $username): array { |
|
| 54 | - if (! $username) { |
|
| 53 | + return $authors->mapWithKeys(function(array $author, string $username): array { |
|
| 54 | + if (!$username) { |
|
| 55 | 55 | throw new InvalidConfigurationException('Author username cannot be empty. Did you forget to set the author\'s array key?', 'hyde', 'authors'); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | protected static function discoverMediaFiles(): Collection |
| 36 | 36 | { |
| 37 | - return collect(static::getMediaFiles())->mapWithKeys(function (string $path): array { |
|
| 37 | + return collect(static::getMediaFiles())->mapWithKeys(function(string $path): array { |
|
| 38 | 38 | $file = MediaFile::make($path); |
| 39 | 39 | |
| 40 | 40 | return [$file->getIdentifier() => $file]; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | /** @var Repository $config */ |
| 44 | 44 | $config = $app->make('config'); |
| 45 | 45 | |
| 46 | - tap($config, function (Repository $config): void { |
|
| 46 | + tap($config, function(Repository $config): void { |
|
| 47 | 47 | $this->config = $config->all(); |
| 48 | 48 | $this->mergeParsedConfiguration(); |
| 49 | 49 | })->set($this->config); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function parseAuthors(array $authors): array |
| 79 | 79 | { |
| 80 | - return Arr::mapWithKeys($authors, function (array $author, string $username): array { |
|
| 80 | + return Arr::mapWithKeys($authors, function(array $author, string $username): array { |
|
| 81 | 81 | $message = 'Invalid author configuration detected in the YAML config file. Please double check the syntax.'; |
| 82 | 82 | |
| 83 | 83 | return InvalidConfigurationException::try(fn () => [$username => PostAuthor::create($author)], $message); |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function parseFeatures(array $features): array |
| 92 | 92 | { |
| 93 | - return array_map(function (string $feature): Feature { |
|
| 93 | + return array_map(function(string $feature): Feature { |
|
| 94 | 94 | $name = Str::studly($feature); |
| 95 | 95 | $case = Feature::fromName($name); |
| 96 | 96 | |
| 97 | - if (! $case) { |
|
| 97 | + if (!$case) { |
|
| 98 | 98 | throw new InvalidConfigurationException("Invalid feature '$feature' specified in the YAML config file. (Feature::$name does not exist)"); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | { |
| 15 | 15 | public function register(): void |
| 16 | 16 | { |
| 17 | - $this->app->make(HydeKernel::class)->booted(function (): void { |
|
| 18 | - $this->app->singleton('navigation.main', function (): MainNavigationMenu { |
|
| 17 | + $this->app->make(HydeKernel::class)->booted(function(): void { |
|
| 18 | + $this->app->singleton('navigation.main', function(): MainNavigationMenu { |
|
| 19 | 19 | return NavigationMenuGenerator::handle(MainNavigationMenu::class); |
| 20 | 20 | }); |
| 21 | 21 | |
| 22 | - $this->app->singleton('navigation.sidebar', function (): DocumentationSidebar { |
|
| 22 | + $this->app->singleton('navigation.sidebar', function(): DocumentationSidebar { |
|
| 23 | 23 | return NavigationMenuGenerator::handle(DocumentationSidebar::class); |
| 24 | 24 | }); |
| 25 | 25 | }); |