Completed
Pull Request — master (#92)
by Christoph
02:02
created

Status   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 14
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A execute() 0 7 4
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author Pascal Clémot <[email protected]>
7
 *
8
 * Nextcloud - Two-factor Gateway
9
 *
10
 * This code is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Affero General Public License, version 3,
12
 * as published by the Free Software Foundation.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License, version 3,
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
21
 *
22
 */
23
24
namespace OCA\TwoFactorGateway\Command;
25
26
use OCA\TwoFactorGateway\Service\Gateway\Signal\Gateway as SignalGateway;
27
use OCA\TwoFactorGateway\Service\Gateway\SMS\Gateway as SMSGateway;
28
use OCA\TwoFactorGateway\Service\Gateway\Telegram\Gateway as TelegramGateway;
29
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
33
class Status extends Command {
34
35
	/** @var SignalGateway */
36
	private $signalGateway;
37
38
	/** @var SMSGateway */
39
	private $smsGateway;
40
41
	/** @var TelegramGateway */
42
	private $telegramGateway;
43
44
	public function __construct(SignalGateway $signalGateway,
45
								SMSGateway $smsGateway,
46
								TelegramGateway $telegramGateway) {
47
		parent::__construct('twofactorauth:gateway:status');
48
		$this->signalGateway = $signalGateway;
49
		$this->smsGateway = $smsGateway;
50
		$this->telegramGateway = $telegramGateway;
51
	}
52
53
	protected function execute(InputInterface $input, OutputInterface $output) {
54
		$signalConfigured = $this->signalGateway->getConfig()->isComplete();
55
		$output->writeln('Signal gateway: ' . ($signalConfigured ? 'configured' : 'not configured'));
56
		$smsConfigured = $this->smsGateway->getConfig()->isComplete();
57
		$output->writeln('SMS gateway: ' . ($smsConfigured ? 'configured' : 'not configured'));
58
		$telegramConfigured = $this->telegramGateway->getConfig()->isComplete();
59
		$output->writeln('Telegram gateway: ' . ($telegramConfigured ? 'configured' : 'not configured'));
60
	}
61
62
}