guestManager = $guestManager; } protected function configure(): void { $this ->setName('guests:list') ->setDescription('List created guests'); parent::configure(); } protected function execute(InputInterface $input, OutputInterface $output): int { $guests = $this->guestManager->getGuestsInfo(); $outputType = $input->getOption('output'); if (count($guests) === 0) { if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { $output->writeln('[]'); } else { $output->writeln('No guests created'); } return 0; } if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { $this->writeArrayInOutputFormat($input, $output, $guests); } else { $table = new Table($output); $table->setHeaders(['Email', 'Name', 'Invited By']); $table->setRows($guests); $table->render(); } return 0; } }