ListProfilesCommand::doExecuteCommand()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 11
cts 11
cp 1
rs 9.6666
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 3
1
<?php
2
3
/*
4
 * This file is part of the XabbuhPandaBundle package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\PandaBundle\Command;
13
14
use Symfony\Component\Console\Helper\Table;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
/**
19
 * List all configured profiles for a cloud.
20
 *
21
 * @author Christian Flothmann <[email protected]>
22
 */
23
final class ListProfilesCommand extends CloudCommand
24
{
25
    protected static $defaultName = 'panda:profile:list';
26
27
    /**
28
     * {@inheritDoc}
29
     */
30 3
    protected function configure()
31
    {
32 3
        $this->setDescription('List all profiles of a cloud');
33
34 3
        parent::configure();
35 3
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40 2
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
41
    {
42 2
        $profiles = $this->getCloud($input)->getProfiles();
43
44 1
        if (count($profiles) > 0) {
45 1
            $table = new Table($output);
46 1
            $table->setHeaders(array('profile id', 'profile name'));
47
48 1
            foreach ($profiles as $profile) {
49 1
                $table->addRow(array(
50 1
                    $profile->getId(),
51 1
                    $profile->getTitle(),
52
                ));
53
            }
54
55 1
            $table->render($output);
0 ignored issues
show
Unused Code introduced by
The call to Table::render() has too many arguments starting with $output.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
56
        }
57 1
    }
58
}
59