@@ -41,7 +41,7 @@ |
||
41 | 41 | $default = $this->getDefault(); |
42 | 42 | $regex = $this->trueAnswerRegex; |
43 | 43 | |
44 | - return function ($answer) use ($default, $regex) { |
|
44 | + return function($answer) use ($default, $regex) { |
|
45 | 45 | if (\is_bool($answer)) { |
46 | 46 | return $answer; |
47 | 47 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return $this->doAsk($output, $question); |
69 | 69 | } |
70 | 70 | |
71 | - $interviewer = function () use ($output, $question) { |
|
71 | + $interviewer = function() use ($output, $question) { |
|
72 | 72 | return $this->doAsk($output, $question); |
73 | 73 | }; |
74 | 74 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) { |
240 | 240 | $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'); |
241 | 241 | } else { |
242 | - $message = '<error>'.$error->getMessage().'</error>'; |
|
242 | + $message = '<error>' . $error->getMessage() . '</error>'; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | $output->writeln($message); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | // as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false. |
285 | 285 | if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) { |
286 | - shell_exec('stty '.$sttyMode); |
|
286 | + shell_exec('stty ' . $sttyMode); |
|
287 | 287 | throw new MissingInputException('Aborted.'); |
288 | 288 | } elseif ("\177" === $c) { // Backspace Character |
289 | 289 | if (0 === $numMatches && 0 !== $i) { |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | $matches = array_filter( |
334 | 334 | $autocomplete($ret), |
335 | - function ($match) use ($ret) { |
|
335 | + function($match) use ($ret) { |
|
336 | 336 | return '' === $ret || str_starts_with($match, $ret); |
337 | 337 | } |
338 | 338 | ); |
@@ -382,13 +382,13 @@ discard block |
||
382 | 382 | $cursor->savePosition(); |
383 | 383 | // Write highlighted text, complete the partially entered response |
384 | 384 | $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))); |
385 | - $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).'</hl>'); |
|
385 | + $output->write('<hl>' . OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)) . '</hl>'); |
|
386 | 386 | $cursor->restorePosition(); |
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
390 | 390 | // Reset stty so it behaves normally again |
391 | - shell_exec('stty '.$sttyMode); |
|
391 | + shell_exec('stty ' . $sttyMode); |
|
392 | 392 | |
393 | 393 | return $fullChoice; |
394 | 394 | } |
@@ -419,16 +419,16 @@ discard block |
||
419 | 419 | private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string |
420 | 420 | { |
421 | 421 | if ('\\' === \DIRECTORY_SEPARATOR) { |
422 | - $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; |
|
422 | + $exe = __DIR__ . '/../Resources/bin/hiddeninput.exe'; |
|
423 | 423 | |
424 | 424 | // handle code running from a phar |
425 | 425 | if ('phar:' === substr(__FILE__, 0, 5)) { |
426 | - $tmpExe = sys_get_temp_dir().'/hiddeninput.exe'; |
|
426 | + $tmpExe = sys_get_temp_dir() . '/hiddeninput.exe'; |
|
427 | 427 | copy($exe, $tmpExe); |
428 | 428 | $exe = $tmpExe; |
429 | 429 | } |
430 | 430 | |
431 | - $sExec = shell_exec('"'.$exe.'"'); |
|
431 | + $sExec = shell_exec('"' . $exe . '"'); |
|
432 | 432 | $value = $trimmable ? rtrim($sExec) : $sExec; |
433 | 433 | $output->writeln(''); |
434 | 434 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $value = fgets($inputStream, 4096); |
450 | 450 | |
451 | 451 | if (self::$stty && Terminal::hasSttyAvailable()) { |
452 | - shell_exec('stty '.$sttyMode); |
|
452 | + shell_exec('stty ' . $sttyMode); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | if (false === $value) { |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | private function setRealFormat(string $format) |
442 | 442 | { |
443 | 443 | // try to use the _nomax variant if available |
444 | - if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) { |
|
445 | - $this->format = self::getFormatDefinition($format.'_nomax'); |
|
444 | + if (!$this->max && null !== self::getFormatDefinition($format . '_nomax')) { |
|
445 | + $this->format = self::getFormatDefinition($format . '_nomax'); |
|
446 | 446 | } elseif (null !== self::getFormatDefinition($format)) { |
447 | 447 | $this->format = self::getFormatDefinition($format); |
448 | 448 | } else { |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | } |
487 | 487 | } |
488 | 488 | } elseif ($this->step > 0) { |
489 | - $message = \PHP_EOL.$message; |
|
489 | + $message = \PHP_EOL . $message; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | $this->previousMessage = $originalMessage; |
@@ -514,43 +514,43 @@ discard block |
||
514 | 514 | private static function initPlaceholderFormatters(): array |
515 | 515 | { |
516 | 516 | return [ |
517 | - 'bar' => function (self $bar, OutputInterface $output) { |
|
517 | + 'bar' => function(self $bar, OutputInterface $output) { |
|
518 | 518 | $completeBars = $bar->getBarOffset(); |
519 | 519 | $display = str_repeat($bar->getBarCharacter(), $completeBars); |
520 | 520 | if ($completeBars < $bar->getBarWidth()) { |
521 | 521 | $emptyBars = $bar->getBarWidth() - $completeBars - Helper::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter())); |
522 | - $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars); |
|
522 | + $display .= $bar->getProgressCharacter() . str_repeat($bar->getEmptyBarCharacter(), $emptyBars); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | return $display; |
526 | 526 | }, |
527 | - 'elapsed' => function (self $bar) { |
|
527 | + 'elapsed' => function(self $bar) { |
|
528 | 528 | return Helper::formatTime(time() - $bar->getStartTime()); |
529 | 529 | }, |
530 | - 'remaining' => function (self $bar) { |
|
530 | + 'remaining' => function(self $bar) { |
|
531 | 531 | if (!$bar->getMaxSteps()) { |
532 | 532 | throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); |
533 | 533 | } |
534 | 534 | |
535 | 535 | return Helper::formatTime($bar->getRemaining()); |
536 | 536 | }, |
537 | - 'estimated' => function (self $bar) { |
|
537 | + 'estimated' => function(self $bar) { |
|
538 | 538 | if (!$bar->getMaxSteps()) { |
539 | 539 | throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); |
540 | 540 | } |
541 | 541 | |
542 | 542 | return Helper::formatTime($bar->getEstimated()); |
543 | 543 | }, |
544 | - 'memory' => function (self $bar) { |
|
544 | + 'memory' => function(self $bar) { |
|
545 | 545 | return Helper::formatMemory(memory_get_usage(true)); |
546 | 546 | }, |
547 | - 'current' => function (self $bar) { |
|
547 | + 'current' => function(self $bar) { |
|
548 | 548 | return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT); |
549 | 549 | }, |
550 | - 'max' => function (self $bar) { |
|
550 | + 'max' => function(self $bar) { |
|
551 | 551 | return $bar->getMaxSteps(); |
552 | 552 | }, |
553 | - 'percent' => function (self $bar) { |
|
553 | + 'percent' => function(self $bar) { |
|
554 | 554 | return floor($bar->getProgressPercent() * 100); |
555 | 555 | }, |
556 | 556 | ]; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | private function buildLine(): string |
577 | 577 | { |
578 | 578 | $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; |
579 | - $callback = function ($matches) { |
|
579 | + $callback = function($matches) { |
|
580 | 580 | if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { |
581 | 581 | $text = $formatter($this, $this->output); |
582 | 582 | } elseif (isset($this->messages[$matches[1]])) { |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | } |
587 | 587 | |
588 | 588 | if (isset($matches[2])) { |
589 | - $text = sprintf('%'.$matches[2], $text); |
|
589 | + $text = sprintf('%' . $matches[2], $text); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | return $text; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $line = preg_replace_callback($regex, $callback, $this->format); |
595 | 595 | |
596 | 596 | // gets string length for each sub line with multiline format |
597 | - $linesLength = array_map(function ($subLine) { |
|
597 | + $linesLength = array_map(function($subLine) { |
|
598 | 598 | return Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r"))); |
599 | 599 | }, explode("\n", $line)); |
600 | 600 |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
189 | - $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) { |
|
189 | + $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function($matches) { |
|
190 | 190 | if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) { |
191 | 191 | return $formatter($this); |
192 | 192 | } |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | private static function initPlaceholderFormatters(): array |
231 | 231 | { |
232 | 232 | return [ |
233 | - 'indicator' => function (self $indicator) { |
|
233 | + 'indicator' => function(self $indicator) { |
|
234 | 234 | return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)]; |
235 | 235 | }, |
236 | - 'message' => function (self $indicator) { |
|
236 | + 'message' => function(self $indicator) { |
|
237 | 237 | return $indicator->message; |
238 | 238 | }, |
239 | - 'elapsed' => function (self $indicator) { |
|
239 | + 'elapsed' => function(self $indicator) { |
|
240 | 240 | return Helper::formatTime(time() - $indicator->startTime); |
241 | 241 | }, |
242 | - 'memory' => function () { |
|
242 | + 'memory' => function() { |
|
243 | 243 | return Helper::formatMemory(memory_get_usage(true)); |
244 | 244 | }, |
245 | 245 | ]; |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | $formatter = $this->getHelperSet()->get('debug_formatter'); |
122 | 122 | |
123 | - return function ($type, $buffer) use ($output, $process, $callback, $formatter) { |
|
123 | + return function($type, $buffer) use ($output, $process, $callback, $formatter) { |
|
124 | 124 | $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); |
125 | 125 | |
126 | 126 | if (null !== $callback) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $messages = $large ? [str_repeat(' ', $len)] : []; |
55 | 55 | for ($i = 0; isset($lines[$i]); ++$i) { |
56 | - $messages[] = $lines[$i].str_repeat(' ', $len - self::width($lines[$i])); |
|
56 | + $messages[] = $lines[$i] . str_repeat(' ', $len - self::width($lines[$i])); |
|
57 | 57 | } |
58 | 58 | if ($large) { |
59 | 59 | $messages[] = str_repeat(' ', $len); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return $message; |
80 | 80 | } |
81 | 81 | |
82 | - return self::substr($message, 0, $length).$suffix; |
|
82 | + return self::substr($message, 0, $length) . $suffix; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -130,7 +130,7 @@ |
||
130 | 130 | return $format[1]; |
131 | 131 | } |
132 | 132 | |
133 | - return floor($secs / $format[2]).' '.$format[1]; |
|
133 | + return floor($secs / $format[2]) . ' ' . $format[1]; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | } |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | if ($titleLength > $limit = $markupLength - 4) { |
486 | 486 | $titleLength = $limit; |
487 | 487 | $formatLength = Helper::width(Helper::removeDecoration($formatter, sprintf($titleFormat, ''))); |
488 | - $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...'); |
|
488 | + $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3) . '...'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | $titleStart = intdiv($markupLength - $titleLength, 2); |
492 | 492 | if (false === mb_detect_encoding($markup, null, true)) { |
493 | 493 | $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength); |
494 | 494 | } else { |
495 | - $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength); |
|
495 | + $markup = mb_substr($markup, 0, $titleStart) . $formattedTitle . mb_substr($markup, $titleStart + $titleLength); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $cellFormat = $cell->getStyle()->getCellFormat(); |
568 | 568 | if (!\is_string($cellFormat)) { |
569 | 569 | $tag = http_build_query($cell->getStyle()->getTagOptions(), '', ';'); |
570 | - $cellFormat = '<'.$tag.'>%s</>'; |
|
570 | + $cellFormat = '<' . $tag . '>%s</>'; |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | if (strstr($content, '</>')) { |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | $eol = str_contains($cell ?? '', "\r\n") ? "\r\n" : "\n"; |
625 | 625 | $escaped = implode($eol, array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode($eol, $cell))); |
626 | 626 | $cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped; |
627 | - $lines = explode($eol, str_replace($eol, '<fg=default;bg=default></>'.$eol, $cell)); |
|
627 | + $lines = explode($eol, str_replace($eol, '<fg=default;bg=default></>' . $eol, $cell)); |
|
628 | 628 | foreach ($lines as $lineKey => $line) { |
629 | 629 | if ($colspan > 1) { |
630 | 630 | $line = new TableCell($line, ['colspan' => $colspan]); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
644 | - return new TableRows(function () use ($rows, $unmergedRows): \Traversable { |
|
644 | + return new TableRows(function() use ($rows, $unmergedRows): \Traversable { |
|
645 | 645 | foreach ($rows as $rowKey => $row) { |
646 | 646 | $rowGroup = [$row instanceof TableSeparator ? $row : $this->fillCells($row)]; |
647 | 647 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $lines = [$cell]; |
688 | 688 | if (strstr($cell, "\n")) { |
689 | 689 | $eol = str_contains($cell, "\r\n") ? "\r\n" : "\n"; |
690 | - $lines = explode($eol, str_replace($eol, '<fg=default;bg=default>'.$eol.'</>', $cell)); |
|
690 | + $lines = explode($eol, str_replace($eol, '<fg=default;bg=default>' . $eol . '</>', $cell)); |
|
691 | 691 | $nbLines = \count($lines) > $nbLines ? substr_count($cell, $eol) : $nbLines; |
692 | 692 | |
693 | 693 | $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | { |
68 | 68 | return array_filter( |
69 | 69 | $this->getOptions(), |
70 | - function ($key) { |
|
70 | + function($key) { |
|
71 | 71 | return \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]); |
72 | 72 | }, |
73 | 73 | \ARRAY_FILTER_USE_KEY |