for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Christoph Wurst <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\TwoFactorGateway\Command;
use OCA\TwoFactorGateway\Provider\Gateway\AGateway;
use OCA\TwoFactorGateway\Provider\Gateway\Factory;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Status extends Command {
public function __construct(
private Factory $gatewayFactory,
) {
parent::__construct('twofactorauth:gateway:status');
}
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output) {
$fqcn = $this->gatewayFactory->getFqcnList();
foreach ($fqcn as $fqcn) {
/** @var AGateway */
$gateway = $this->gatewayFactory->get($fqcn);
$isConfigured = $gateway->isComplete();
$settings = $gateway->getSettings();
$output->writeln($settings->name . ': ' . ($isConfigured ? 'configured' : 'not configured'));
return 0;