RprtCli/app/src/Commands/RprtCommand.php

49 lines
1.1 KiB
PHP
Raw Normal View History

<?php
// src/Commands/RprtCommand.php;
namespace RprtCli\Commands;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableSeparator;
class RprtCommand extends Command {
//public function __construct() {
// }
/**
* Get configuration.
*/
protected function configure(): void {
$this->setName('rprt');
$this->setDescription('Generate monthly report');
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->dummyOutput($input, $output);
return Command::SUCCESS;
}
protected function dummyOutput(InputInterface $input, OutputInterface $output): void {
$output->writeln('I will output a nice table.');
$table = New Table($output);
$table->setHeaders(['Project', 'Hours', 'Price']);
$table->setRows([
['LDP', 100, 2600],
['WV', 50, 1300],
new TableSeparator(),
['Zusamen', 150, 3900],
]);
// $table->setStyle('borderless');
$table->render();
}
}