Completed
Push — master ( 8024bc...f8f0d2 )
by Vitor
14s
created

Status   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 10
c 0
b 0
f 0
dl 0
loc 18
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 11 3
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * SPDX-FileCopyrightText: 2024 Christoph Wurst <[email protected]>
7
 * SPDX-License-Identifier: AGPL-3.0-or-later
8
 */
9
10
namespace OCA\TwoFactorGateway\Command;
11
12
use OCA\TwoFactorGateway\Provider\Gateway\AGateway;
13
use OCA\TwoFactorGateway\Provider\Gateway\Factory;
14
use Symfony\Component\Console\Command\Command;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
class Status extends Command {
19 1
	public function __construct(
20
		private Factory $gatewayFactory,
21
	) {
22 1
		parent::__construct('twofactorauth:gateway:status');
23
	}
24
25 1
	#[\Override]
26
	protected function execute(InputInterface $input, OutputInterface $output) {
27 1
		$fqcn = $this->gatewayFactory->getFqcnList();
28 1
		foreach ($fqcn as $fqcn) {
29
			/** @var AGateway */
30 1
			$gateway = $this->gatewayFactory->get($fqcn);
31 1
			$isConfigured = $gateway->isComplete();
32 1
			$settings = $gateway->getSettings();
33 1
			$output->writeln($settings->name . ': ' . ($isConfigured ? 'configured' : 'not configured'));
34
		}
35 1
		return 0;
36
	}
37
}
38