protected function execute(InputInterface $input, OutputInterface $output) { $action = $input->getOption('action'); if (!is_numeric($input->getOption('time'))) { throw new Exception("FATAL ERROR: Input parametr time is not a number!"); } if ($input->getOption('time') < 86400) { throw new Exception("FATAL ERROR: Input parametr time is too small!"); } $wd = new WatchdogSimple($this->config); switch ($action) { // RENEW case 'renew': if ($input->getOption('domain') == "all") { if ($x = $wd->renewAllDomain($input->getOption('time')) > 0) { echo PHP_EOL . "Renew: " . $x . " certificate/s." . PHP_EOL; } } else { $wd->renewOneDomain($input->getOption('domain'), $input->getOption('time')); } break; // REVOKE // REVOKE case 'revoke': if ($input->getOption('domain') == "all") { if ($x = $wd->revokeAllDomain() > 0) { echo PHP_EOL . "Revoke: " . $x . " certificate/s." . PHP_EOL; } } else { $wd->revokeOneDomain($input->getOption('domain')); } break; default: echo '?? Nothing to do.' . PHP_EOL; break; } }