@@ -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 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | collect(static::$data) |
75 | 75 | ->map( |
76 | 76 | static fn ($items) => collect($items) |
77 | - ->map(static function ($value) { |
|
77 | + ->map(static function($value) { |
|
78 | 78 | if (is_array($value)) { |
79 | 79 | return [$value]; |
80 | 80 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ->all(); |
90 | 90 | })->flatten(1) |
91 | 91 | ) |
92 | - ->sortBy(static function ($data, $key) { |
|
92 | + ->sortBy(static function($data, $key) { |
|
93 | 93 | $index = array_search($key, ['Environnement', 'Cache', 'Gestionnaires'], true); |
94 | 94 | |
95 | 95 | return $index === false ? 99 : $index; |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function displayDetail(Collection $data): void |
115 | 115 | { |
116 | - $data->each(function ($data, $section) { |
|
116 | + $data->each(function($data, $section) { |
|
117 | 117 | $this->newLine(); |
118 | 118 | |
119 | 119 | $this->justify($section, '', ['first' => ['fg' => Color::GREEN]]); |
120 | 120 | |
121 | - $data->pipe(static fn ($data) => $section !== 'Environnement' ? $data->sort() : $data)->each(function ($detail) { |
|
121 | + $data->pipe(static fn ($data) => $section !== 'Environnement' ? $data->sort() : $data)->each(function($detail) { |
|
122 | 122 | [$label, $value] = $detail; |
123 | 123 | |
124 | 124 | $this->justify($label, value($value, false)); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function displayJson(Collection $data): void |
133 | 133 | { |
134 | - $output = $data->flatMap(function ($data, $section) { |
|
134 | + $output = $data->flatMap(function($data, $section) { |
|
135 | 135 | return [ |
136 | 136 | (string) Text::of($section)->snake() => $data->mapWithKeys(fn ($item, $key) => [ |
137 | 137 | $this->toSearchKeyword($item[0]) => value($item[1], true), |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | static::addToSection('Gestionnaires', static fn () => array_filter([ |
176 | 176 | 'Cache' => config('cache.handler'), |
177 | 177 | 'Base de données' => config('database.default'), |
178 | - 'Logs' => static function ($json) { |
|
178 | + 'Logs' => static function($json) { |
|
179 | 179 | $handlers = []; |
180 | 180 | |
181 | 181 | foreach (config('log.handlers') as $k => $v) { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public static function format(mixed $value, ?Closure $console = null, ?Closure $json = null) |
250 | 250 | { |
251 | - return static function ($isJson) use ($value, $console, $json) { |
|
251 | + return static function($isJson) use ($value, $console, $json) { |
|
252 | 252 | if ($isJson === true && $json instanceof Closure) { |
253 | 253 | return value($json, $value); |
254 | 254 | } |
@@ -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 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function commandExists(string $commandName): bool |
172 | 172 | { |
173 | - return ! empty($this->_commands[$commandName]); |
|
173 | + return !empty($this->_commands[$commandName]); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -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); |