@@ -60,7 +60,7 @@ |
||
| 60 | 60 | '--namespace' => ["Définissez l'espace de noms racine. Par défaut\u{a0}: \"APP_NAMESPACE\".", APP_NAMESPACE], |
| 61 | 61 | '--suffix' => ['Ajoutez le titre du composant au nom de la classe (par exemple, User => UserController).', true], |
| 62 | 62 | '--force' => 'Forcer l\'écrasement du fichier existant.', |
| 63 | - ]; |
|
| 63 | + ]; |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * {@inheritDoc} |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | collect(static::$data) |
| 76 | 76 | ->map(fn ($items) => collect($items) |
| 77 | - ->map(function ($value) { |
|
| 77 | + ->map(function($value) { |
|
| 78 | 78 | if (is_array($value)) { |
| 79 | 79 | return [$value]; |
| 80 | 80 | } |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | ->all(); |
| 90 | 90 | })->flatten(1) |
| 91 | 91 | ) |
| 92 | - ->sortBy(function ($data, $key) { |
|
| 92 | + ->sortBy(function($data, $key) { |
|
| 93 | 93 | $index = array_search($key, ['Environnement', 'Cache', 'Gestionnaires']); |
| 94 | 94 | |
| 95 | 95 | return $index === false ? 99 : $index; |
| 96 | 96 | }) |
| 97 | - ->filter(function ($data, $key) { |
|
| 97 | + ->filter(function($data, $key) { |
|
| 98 | 98 | return $this->option('only') ? in_array($this->toSearchKeyword($key), $this->sections()) : true; |
| 99 | 99 | }) |
| 100 | 100 | ->pipe(fn ($data) => $this->display($data)); |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | protected function displayDetail(Collection $data): void |
| 118 | 118 | { |
| 119 | - $data->each(function ($data, $section) { |
|
| 119 | + $data->each(function($data, $section) { |
|
| 120 | 120 | $this->newLine(); |
| 121 | 121 | |
| 122 | 122 | $this->justify($section, '', ['first' => ['fg' => Color::GREEN]]); |
| 123 | 123 | |
| 124 | - $data->pipe(fn ($data) => $section !== 'Environnement' ? $data->sort() : $data)->each(function ($detail) { |
|
| 124 | + $data->pipe(fn ($data) => $section !== 'Environnement' ? $data->sort() : $data)->each(function($detail) { |
|
| 125 | 125 | [$label, $value] = $detail; |
| 126 | 126 | |
| 127 | 127 | $this->justify($label, value($value, false)); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function displayJson(Collection $data): void |
| 136 | 136 | { |
| 137 | - $output = $data->flatMap(function ($data, $section) { |
|
| 137 | + $output = $data->flatMap(function($data, $section) { |
|
| 138 | 138 | return [ |
| 139 | 139 | (string) Text::of($section)->snake() => $data->mapWithKeys(fn ($item, $key) => [ |
| 140 | 140 | $this->toSearchKeyword($item[0]) => value($item[1], true), |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | static::addToSection('Gestionnaires', fn () => array_filter([ |
| 179 | 179 | 'Cache' => config('cache.handler'), |
| 180 | 180 | 'Base de données' => config('database.default'), |
| 181 | - 'Logs' => function ($json) { |
|
| 181 | + 'Logs' => function($json) { |
|
| 182 | 182 | $handlers = []; |
| 183 | 183 | foreach (config('log.handlers') as $k => $v) { |
| 184 | 184 | $handlers[] = $k; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | protected function hasPhpFiles(string $path): bool |
| 200 | 200 | { |
| 201 | - return count(glob($path.'/*.php')) > 0; |
|
| 201 | + return count(glob($path . '/*.php')) > 0; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public static function format(mixed $value, Closure $console = null, Closure $json = null) |
| 251 | 251 | { |
| 252 | - return function ($isJson) use ($value, $console, $json) { |
|
| 252 | + return function($isJson) use ($value, $console, $json) { |
|
| 253 | 253 | if ($isJson === true && $json instanceof Closure) { |
| 254 | 254 | return value($json, $value); |
| 255 | 255 | } elseif ($isJson === false && $console instanceof Closure) { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | foreach ($options as $key => $value) { |
| 159 | 159 | $key = preg_replace('/^\-\-/', '', $key); |
| 160 | - if (! isset($options[$key])) { |
|
| 160 | + if (!isset($options[$key])) { |
|
| 161 | 161 | $options[$key] = $value; |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | foreach ($files as $file) { |
| 206 | 206 | $className = $locator->findQualifiedNameFromPath($file); |
| 207 | 207 | |
| 208 | - if ($className === false || ! class_exists($className)) { |
|
| 208 | + if ($className === false || !class_exists($className)) { |
|
| 209 | 209 | continue; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $class = new ReflectionClass($className); |
| 232 | 232 | $logger = $logger ?: Services::logger(); |
| 233 | 233 | |
| 234 | - if (! $class->isInstantiable() || ! $class->isSubclassOf(Command::class)) { |
|
| 234 | + if (!$class->isInstantiable() || !$class->isSubclassOf(Command::class)) { |
|
| 235 | 235 | throw CLIException::invalidCommand($className); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -258,13 +258,13 @@ discard block |
||
| 258 | 258 | $value = (array) $value; |
| 259 | 259 | |
| 260 | 260 | $description = $value[0]; |
| 261 | - if (! is_string($description)) { |
|
| 261 | + if (!is_string($description)) { |
|
| 262 | 262 | continue; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | $default = $value[1] ?? null; |
| 266 | 266 | $filter = $value[2] ?? null; |
| 267 | - if ($filter !== null && ! is_callable($filter)) { |
|
| 267 | + if ($filter !== null && !is_callable($filter)) { |
|
| 268 | 268 | $filter = null; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $value = (array) $value; |
| 277 | 277 | |
| 278 | 278 | $description = $value[0]; |
| 279 | - if (! is_string($description)) { |
|
| 279 | + if (!is_string($description)) { |
|
| 280 | 280 | continue; |
| 281 | 281 | } |
| 282 | 282 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $console = $this; |
| 289 | - $action = function (?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) { |
|
| 289 | + $action = function(?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) { |
|
| 290 | 290 | foreach ($instance->required as $package) { |
| 291 | 291 | $package = explode(':', $package); |
| 292 | 292 | $version = $package[1] ?? null; |
@@ -295,9 +295,9 @@ discard block |
||
| 295 | 295 | /** @var \Ahc\Cli\IO\Interactor $io */ |
| 296 | 296 | $io = $this->io(); |
| 297 | 297 | |
| 298 | - if (! InstalledVersions::isInstalled($package)) { |
|
| 298 | + if (!InstalledVersions::isInstalled($package)) { |
|
| 299 | 299 | $io->info('Cette commande nécessite le package "' . $package . '" mais vous ne l\'avez pas', true); |
| 300 | - if (! $io->confirm('Voulez-vous l\'installer maintenant ?')) { |
|
| 300 | + if (!$io->confirm('Voulez-vous l\'installer maintenant ?')) { |
|
| 301 | 301 | return; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $suppress = $suppress ?: $console->suppress; |
| 316 | - if (! $suppress) { |
|
| 316 | + if (!$suppress) { |
|
| 317 | 317 | $console->start($instance); |
| 318 | 318 | } |
| 319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | $result = $instance->setOptions($options)->setArguments($arguments)->execute($parameters); |
| 330 | 330 | |
| 331 | - if (! $suppress) { |
|
| 331 | + if (!$suppress) { |
|
| 332 | 332 | $console->end(); |
| 333 | 333 | } |
| 334 | 334 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | private function registerException(Logger $logger) |
| 345 | 345 | { |
| 346 | - $this->onException(static function (Throwable $e, int $exitCode) use ($logger) { |
|
| 346 | + $this->onException(static function(Throwable $e, int $exitCode) use ($logger) { |
|
| 347 | 347 | $logger->error((string) $e, ['exitCode' => $exitCode, 'klinge' => true]); |
| 348 | 348 | |
| 349 | 349 | throw new CLIException($e->getMessage(), $exitCode, $e); |
@@ -557,9 +557,9 @@ discard block |
||
| 557 | 557 | return new ProgressBar($total, $this->writer); |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - /** |
|
| 561 | - * Ecrit deux textes de maniere justifiee dans la console (l'un a droite, l'autre a gauche) |
|
| 562 | - */ |
|
| 560 | + /** |
|
| 561 | + * Ecrit deux textes de maniere justifiee dans la console (l'un a droite, l'autre a gauche) |
|
| 562 | + */ |
|
| 563 | 563 | final public function justify(string $first, ?string $second = '', array $options = []): self |
| 564 | 564 | { |
| 565 | 565 | $options = [ |
@@ -592,9 +592,9 @@ discard block |
||
| 592 | 592 | return $this->write($first . ' ' . str_repeat((string) $options['sep'], $dashWidth) . ' ' . $second)->eol(); |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - /** |
|
| 596 | - * Ecrit un texte au centre de la console |
|
| 597 | - */ |
|
| 595 | + /** |
|
| 596 | + * Ecrit un texte au centre de la console |
|
| 597 | + */ |
|
| 598 | 598 | final public function center(string $text, array $options = []): self |
| 599 | 599 | { |
| 600 | 600 | $sep = $options['sep'] ?? ' '; |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | final public function success(string $message, bool $badge = true, string $label = 'SUCCESS'): self |
| 306 | 306 | { |
| 307 | - if (! $badge) { |
|
| 307 | + if (!$badge) { |
|
| 308 | 308 | $this->writer->okBold($label); |
| 309 | 309 | } else { |
| 310 | 310 | $this->writer->boldWhiteBgGreen(" {$label} "); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | final public function warning(string $message, bool $badge = true, string $label = 'WARNING'): self |
| 320 | 320 | { |
| 321 | - if (! $badge) { |
|
| 321 | + if (!$badge) { |
|
| 322 | 322 | $this->writer->warnBold($label); |
| 323 | 323 | } else { |
| 324 | 324 | $this->writer->boldWhiteBgYellow(" {$label} "); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | final public function info(string $message, bool $badge = true, string $label = 'INFO'): self |
| 334 | 334 | { |
| 335 | - if (! $badge) { |
|
| 335 | + if (!$badge) { |
|
| 336 | 336 | $this->writer->infoBold($label); |
| 337 | 337 | } else { |
| 338 | 338 | $this->writer->boldWhiteBgCyan(" {$label} "); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | final public function error(string $message, bool $badge = true, string $label = 'ERROR'): self |
| 348 | 348 | { |
| 349 | - if (! $badge) { |
|
| 349 | + if (!$badge) { |
|
| 350 | 350 | $this->writer->errorBold($label); |
| 351 | 351 | } else { |
| 352 | 352 | $this->writer->boldWhiteBgRed(" {$label} "); |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | final public function json($data): self |
| 451 | 451 | { |
| 452 | - $this->write(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), true); |
|
| 452 | + $this->write(json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), true); |
|
| 453 | 453 | |
| 454 | 454 | return $this; |
| 455 | 455 | } |