46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Command;
|
|
|
|
use App\Repository\UserRepository;
|
|
use Psr\Log\LoggerInterface;
|
|
use Symfony\Component\Console\Attribute\Argument;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Attribute\Option;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
|
|
#[AsCommand(
|
|
name: 'app:send-report',
|
|
description: 'Sends the report',
|
|
aliases: ['report'],
|
|
)]
|
|
final class SendReportCommand
|
|
{
|
|
public function __construct(
|
|
private readonly UserRepository $userRepository,
|
|
private readonly LoggerInterface $logger,
|
|
) {
|
|
}
|
|
|
|
public function __invoke(
|
|
SymfonyStyle $io,
|
|
#[Argument('The user')] string $user,
|
|
#[Argument] int $months = 3,
|
|
#[Option('Change nothing')] bool $dryRun = false,
|
|
#[Option(shortcut: 'f')] string $format = 'pdf',
|
|
#[Option] array $tag = [],
|
|
#[Option] ?bool $color = null,
|
|
#[Option] int|bool $limit = false,
|
|
): int {
|
|
$io->title('Report');
|
|
$go = $io->confirm('Send it?', false);
|
|
$io->table(['Id', 'Name'], [
|
|
['1', 'Ada'],
|
|
['2', 'Alan'],
|
|
]);
|
|
$io->success('Sent.');
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|