Completed
Push — master ( 7d6b25...de2ef0 )
by Thomas
14:16
created

ListGroupMembers::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Phil Davis <[email protected]>
4
 *
5
 * @copyright Copyright (c) 2017, ownCloud GmbH
6
 * @license AGPL-3.0
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OC\Core\Command\Group;
23
24
use OC\Core\Command\Base;
25
use OCP\IGroupManager;
26
use Symfony\Component\Console\Input\InputInterface;
27
use Symfony\Component\Console\Output\OutputInterface;
28
use Symfony\Component\Console\Input\InputArgument;
29
30
class ListGroupMembers extends Base {
31
	/** @var \OCP\IGroupManager */
32
	protected $groupManager;
33
34
	/**
35
	 * @param IGroupManager $groupManager
36
	 */
37
	public function __construct(IGroupManager $groupManager) {
38
		parent::__construct();
39
		$this->groupManager = $groupManager;
40
	}
41
42
	protected function configure() {
43
		parent::configure();
44
45
		$this
46
			->setName('group:list-members')
47
			->setDescription('list group members')
48
			->addArgument(
49
				'group',
50
				InputArgument::REQUIRED,
51
				'Name of the group'
52
			)
53
		;
54
	}
55
56 View Code Duplication
	protected function execute(InputInterface $input, OutputInterface $output) {
57
		$groupName = $input->getArgument('group');
58
		$group = $this->groupManager->get($groupName);
59
		if (!$group) {
60
			$output->writeln("<error>Group $groupName does not exist</error>");
61
			return 1;
62
		}
63
64
		$displayNames = $this->groupManager->displayNamesInGroup($group->getGID());
65
		parent::writeArrayInOutputFormat($input, $output, $displayNames);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (writeArrayInOutputFormat() instead of execute()). Are you sure this is correct? If so, you might want to change this to $this->writeArrayInOutputFormat().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
66
	}
67
}
68