ListCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 12
cts 12
cp 1
rs 9.6
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\Console\Command\Manifest;
11
12
use Symfony\Component\Console\Helper\Table;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Output\OutputInterface;
15
use Transfer\Manifest\ManifestInterface;
16
17
/**
18
 * Command for listing manifests in manifest chain.
19
 */
20
class ListCommand extends ManifestCommand
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 6
    protected function configure()
26
    {
27 6
        parent::configure();
28
29 6
        $this
30 6
            ->setName('manifest:list')
31 6
            ->setDescription('List registered manifests');
32 6
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 4
    protected function execute(InputInterface $input, OutputInterface $output)
38
    {
39 4
        parent::execute($input, $output);
40
41 2
        $manifests = $this->chain->getManifests();
42
43 2
        $rows = array();
44
45
        /** @var ManifestInterface $manifest */
46 2
        foreach ($manifests as $manifest) {
47 1
            $rows[] = array($manifest->getName());
48 2
        }
49
50 2
        $table = new Table($output);
51
52 2
        $table->setHeaders(array('Manifest name'))
53 2
              ->setRows($rows);
54
55 2
        $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 2
    }
57
}
58