Apply rector, phpstan and php-cs-fixer
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-29 19:52:02 +01:00
parent f35c24d35d
commit b07b0b2ae8
22 changed files with 869 additions and 1105 deletions

View File

@ -2,25 +2,23 @@
namespace trizz\AdventOfCode;
use PhpPkg\CliMarkdown\CliMarkdown;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use trizz\AdventOfCode\Utils\SymfonyConsoleMarkdown;
class Puzzle extends Command
final class Puzzle extends Command
{
protected function configure(): void
{
$this
->setName('puzzle')
->setDescription('Show the puzzle description.')
->addArgument('day', InputArgument::REQUIRED, 'The day number.')
->addArgument('year', InputArgument::OPTIONAL, 'The year', date('y'));
}
/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$contents = file_get_contents(
@ -31,7 +29,14 @@ class Puzzle extends Command
(int) $input->getArgument('day')
)
);
$rendered = (new SymfonyConsoleMarkdown())->render($contents);
if (!$contents) {
$output->writeln('Can not read puzzle.');
return Command::FAILURE;
}
$rendered = (new CliMarkdown())->render($contents);
$output->writeln($rendered);