addArgument('file', InputArgument::REQUIRED, 'Path to a file containing a list of domain names'); } /** * @throws ExceptionInterface */ protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $file = $input->getArgument('file'); if (!file_exists($file) || !is_readable($file)) { $io->error(sprintf('File "%s" does not exist or is not readable.', $file)); return Command::FAILURE; } $domains = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if (empty($domains)) { $io->warning('The list is empty.'); return Command::SUCCESS; } $io->title('Registering domains'); /** @var string $ldhName */ foreach ($domains as $ldhName) { $this->messageBus->dispatch(new UpdateDomain($ldhName, null), [ new TransportNamesStamp('rdap_low'), ]); } $io->success(sprintf('Imported %d domain names.', count($domains))); return Command::SUCCESS; } }