addArgument('aktion', InputArgument::OPTIONAL, 'an, aus, hsts-an oder hsts-aus; ohne Angabe der Stand.'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $action = (string) $input->getArgument('aktion'); if ('' === $action) { $state = $this->https->state(); $io->writeln(sprintf('Umleitung auf HTTPS: %s · HSTS: %s%s', $state['redirect'] ? 'an' : 'aus', $state['hsts'] ? 'an' : 'aus', $state['found'] ? '' : ' · Zeilen fehlen in public/.htaccess')); return Command::SUCCESS; } $result = match ($action) { 'an' => $this->https->enableRedirect($this->siteOrigin), 'aus' => $this->https->disableRedirect(), 'hsts-an' => $this->https->switchHsts(true, $this->siteOrigin), 'hsts-aus' => $this->https->switchHsts(false, $this->siteOrigin), default => ['ok' => false, 'message' => 'Erlaubt sind an, aus, hsts-an und hsts-aus.'], }; $result['ok'] ? $io->success($result['message']) : $io->error($result['message']); return $result['ok'] ? Command::SUCCESS : Command::FAILURE; } }