addArgument('station-name', InputArgument::OPTIONAL) ->addOption( 'no-supervisor-restart', null, InputOption::VALUE_NONE, 'Do not reload Supervisord immediately with changes.' ); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $stationName = $input->getArgument('station-name'); $noSupervisorRestart = (bool)$input->getOption('no-supervisor-restart'); if (!empty($stationName)) { $station = $this->stationRepo->findByIdentifier($stationName); if (!$station instanceof Entity\Station) { $io->error('Station not found.'); return 1; } $stations = [$station]; } else { $io->section('Restarting all radio stations...'); /** @var Entity\Station[] $stations */ $stations = $this->stationRepo->fetchAll(); } $io->progressStart(count($stations)); foreach ($stations as $station) { try { $this->configuration->writeConfiguration( station: $station, reloadSupervisor: !$noSupervisorRestart, forceRestart: true ); } catch (Throwable $e) { $io->error([ $station . ': ' . $e->getMessage(), ]); } $io->progressAdvance(); } $io->progressFinish(); return 0; } }