Completed
Push — master ( 1eadc9...2741a1 )
by Maxence
14s queued 11s
created

CirclesTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 54
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A configure() 0 5 1
A execute() 0 6 1
1
<?php declare(strict_types=1);
2
3
4
/**
5
 * Circles - Bring cloud-users closer together.
6
 *
7
 * This file is licensed under the Affero General Public License version 3 or
8
 * later. See the COPYING file.
9
 *
10
 * @author Maxence Lange <[email protected]>
11
 * @copyright 2017
12
 * @license GNU AGPL version 3 or any later version
13
 *
14
 * This program is free software: you can redistribute it and/or modify
15
 * it under the terms of the GNU Affero General Public License as
16
 * published by the Free Software Foundation, either version 3 of the
17
 * License, or (at your option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 * GNU Affero General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU Affero General Public License
25
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26
 *
27
 */
28
29
30
namespace OCA\Circles\Command;
31
32
use daita\MySmallPhpTools\Traits\TArrayTools;
33
use OC\Core\Command\Base;
34
use OCA\Circles\Exceptions\ConfigNoCircleAvailableException;
35
use OCA\Circles\Service\ConfigService;
36
use OCA\Circles\Service\GlobalScaleService;
37
use OCP\IL10N;
38
use Symfony\Component\Console\Input\InputInterface;
39
use Symfony\Component\Console\Output\OutputInterface;
40
41
42
/**
43
 * Class CirclesList
44
 *
45
 * @package OCA\Circles\Command
46
 */
47
class CirclesTest extends Base {
48
49
50
	use TArrayTools;
51
52
53
	/** @var IL10N */
54
	private $l10n;
55
56
	/** @var GlobalScaleService */
57
	private $globalScaleService;
58
59
	/** @var ConfigService */
60
	private $configService;
61
62
	/**
63
	 * CirclesList constructor.
64
	 *
65
	 * @param IL10N $l10n
66
	 * @param GlobalScaleService $globalScaleService
67
	 * @param ConfigService $configService
68
	 */
69
	public function __construct(
70
		IL10N $l10n, GlobalScaleService $globalScaleService, ConfigService $configService
71
	) {
72
		parent::__construct();
73
74
		$this->l10n = $l10n;
75
		$this->globalScaleService = $globalScaleService;
76
		$this->configService = $configService;
77
	}
78
79
80
	protected function configure() {
81
		parent::configure();
82
		$this->setName('circles:test')
83
			 ->setDescription('testing some features');
84
	}
85
86
87
	/**
88
	 * @param InputInterface $input
89
	 * @param OutputInterface $output
90
	 *
91
	 * @return int
92
	 */
93
	protected function execute(InputInterface $input, OutputInterface $output): int {
94
		$instances = $this->globalScaleService->getInstances(true);
95
		$output->writeln('<info>Instances: </info>' . json_encode($instances));
96
97
		return 0;
98
	}
99
100
}
101
102