setName('test') ->setDescription('Test day'); } #[\Override] protected function execute(InputInterface $input, OutputInterface $output): int { $results = $this->getSolutions(); $solution = $this->loadClass(); if (in_array($this->part, [0, 1], true)) { $output->writeln('Part 1'); $this->render($output, 'Example', $solution::$part1ExampleResult, $results['part1Example']); $this->render($output, 'Puzzle', $solution::$part1Result, $results['part1']); } if ($this->part === 0) { $output->writeln(str_repeat('-', strlen($this->title))); } if (in_array($this->part, [0, 2], true)) { $output->writeln('Part 2'); $this->render($output, 'Example', $solution::$part2ExampleResult, $results['part2Example']); $this->render($output, 'Puzzle', $solution::$part2Result, $results['part2']); } return Command::SUCCESS; } private function render(OutputInterface $output, string $title, null|int|string $expected, null|int|string $result): void { if ($title === 'Example' && $this->skipExamples) { return; } $color = $expected === $result ? 'green' : 'red'; $output->writeln(sprintf(' %s:', $title)); $output->writeln(sprintf(' Expected: %s', $color, $expected)); $output->writeln(sprintf(' Result: %s', $color, $result)); } }