mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-16 10:59:31 +00:00
apply rector rules
This commit is contained in:
@@ -13,35 +13,27 @@ namespace Chill\MainBundle\Command;
|
||||
|
||||
use Chill\MainBundle\Service\Import\AddressReferenceFromBAN;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[\Symfony\Component\Console\Attribute\AsCommand(name: 'chill:main:address-ref-from-ban')]
|
||||
class LoadAddressesFRFromBANCommand extends Command
|
||||
class LoadAddressesFRFromBANCommand
|
||||
{
|
||||
protected static $defaultDescription = 'Import FR addresses from BAN (see https://adresses.data.gouv.fr';
|
||||
|
||||
public function __construct(private readonly AddressReferenceFromBAN $addressReferenceFromBAN)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers')
|
||||
->addOption('send-report-email', 's', InputOption::VALUE_REQUIRED, 'Email address where a list of unimported addresses can be send');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
public function __invoke(#[\Symfony\Component\Console\Attribute\Argument(name: 'departementNo', description: 'a list of departement numbers')]
|
||||
array $departementno, #[\Symfony\Component\Console\Attribute\Option(name: 'send-report-email', shortcut: 's', mode: InputOption::VALUE_REQUIRED, description: 'Email address where a list of unimported addresses can be send')]
|
||||
$sendReportEmail, OutputInterface $output): int
|
||||
{
|
||||
dump(__METHOD__);
|
||||
foreach ($input->getArgument('departementNo') as $departementNo) {
|
||||
foreach ($departementNo as $departementNo) {
|
||||
$output->writeln('Import addresses for '.$departementNo);
|
||||
|
||||
$this->addressReferenceFromBAN->import($departementNo, $input->hasOption('send-report-email') ? $input->getOption('send-report-email') : null);
|
||||
$this->addressReferenceFromBAN->import($departementNo, $input->hasOption('send-report-email') ? $send_report_email : null);
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user