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

Status::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
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