ProfileInfoCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 8
cts 8
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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\InputArgument;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
/**
20
 * Show a profile's details.
21
 *
22
 * @author Christian Flothmann <[email protected]>
23
 */
24
final class ProfileInfoCommand extends CloudCommand
25
{
26
    protected static $defaultName = 'panda:profile:info';
27
28
    /**
29
     * {@inheritDoc}
30
     */
31 4
    protected function configure()
32
    {
33 4
        $this->setDescription('Fetch information for a profile');
34 4
        $this->addArgument(
35 4
            'profile-id',
36 4
            InputArgument::REQUIRED,
37 4
            'The id of the profile being fetched'
38
        );
39
40 4
        parent::configure();
41 4
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46 2
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
47
    {
48 2
        $profile = $this->getCloud($input)->getProfile($input->getArgument('profile-id'));
0 ignored issues
show
Bug introduced by
It seems like $input->getArgument('profile-id') targeting Symfony\Component\Consol...nterface::getArgument() can also be of type array<integer,string> or null; however, Xabbuh\PandaClient\Api\C...Interface::getProfile() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
49 1
        $table = new Table($output);
50 1
        $table->addRows(array(
51 1
            array('id', $profile->getId()),
52 1
            array('title', $profile->getTitle()),
53 1
            array('name', $profile->getName()),
54 1
            array('file extension', $profile->getExtname()),
55 1
            array('width', $profile->getWidth()),
56 1
            array('height', $profile->getHeight()),
57 1
            array('audio bit rate', $profile->getAudioBitrate()),
58 1
            array('video bit rate', $profile->getVideoBitrate()),
59 1
            array('aspect mode', $profile->getAspectMode()),
60 1
            array('created at', $profile->getCreatedAt()),
61 1
            array('updated at', $profile->getUpdatedAt()),
62
        ));
63 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...
64 1
    }
65
}
66