setName('oauth2:delete-client');
$this->setDescription('This command removes an existing oauth2 client.');
$this->addArgument(
self::ARGUMENT_CLIENT_ID,
InputArgument::REQUIRED,
'Id of the oauth2 client',
);
}
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int {
$id = (int)$input->getArgument(self::ARGUMENT_CLIENT_ID);
if ($id === 0) {
$output->writeln('The given id is not a valid positive integer.');
return Command::FAILURE;
}
try {
$this->clientService->deleteClient($id);
} catch (\Exception $exception) {
$output->writeln('' . $exception->getMessage() . '');
return Command::FAILURE;
}
return Command::SUCCESS;
}
}