> */ private const LOOKUP_TABLE = [ '.' => ['gray', '.'], 'S' => ['yellow', 's'], 'T' => ['cyan', 't'], 'I' => ['yellow', 'i'], 'N' => ['yellow', 'i'], 'R' => ['yellow', '!'], 'W' => ['yellow', '!'], 'E' => ['red', '⨯'], 'F' => ['red', '⨯'], ]; /** * Creates a new instance of the Compact Printer. */ public function __construct( private readonly Terminal $terminal, private readonly OutputInterface $output, private readonly Style $style, private readonly int $compactSymbolsPerLine, ) { // .. } /** * Creates a new instance of the Compact Printer. */ public static function default(): self { return new self( terminal(), new ConsoleOutput(decorated: true), new Style(new ConsoleOutput(decorated: true)), terminal()->width() - 4, ); } /** * Output an empty line in the console. Useful for providing a little breathing room. */ public function newLine(): void { render('
'); } /** * Write the given message to the console, adding vertical and horizontal padding. */ public function line(string $message): void { render("{$message}"); } /** * Outputs the given description item from the ProgressPrinter as a gorgeous, colored symbol. */ public function descriptionItem(string $item): void { [$color, $icon] = self::LOOKUP_TABLE[$item] ?? self::LOOKUP_TABLE['.']; $symbolsOnCurrentLine = $this->processed % $this->compactSymbolsPerLine; if ($symbolsOnCurrentLine >= $this->terminal->width() - 4) { $symbolsOnCurrentLine = 0; } if ($symbolsOnCurrentLine === 0) { $this->output->writeln(''); $this->output->write(' '); } $this->output->write(sprintf('