DeleteEncodingCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
cbo 5
dl 0
loc 33
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 11 1
A doExecuteCommand() 0 10 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\Input\InputArgument;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
use Xabbuh\PandaClient\Model\Encoding;
18
19
/**
20
 * Command to delete an encoding.
21
 *
22
 * @author Christian Flothmann <[email protected]>
23
 */
24
final class DeleteEncodingCommand extends CloudCommand
25
{
26
    protected static $defaultName = 'panda:encoding:delete';
27
28
    /**
29
     * {@inheritDoc}
30
     */
31 5
    protected function configure()
32
    {
33 5
        $this->setDescription('Delete an encoding');
34 5
        $this->addArgument(
35 5
            'encoding-id',
36 5
            InputArgument::REQUIRED,
37 5
            'Id of the encoding'
38
        );
39
40 5
        parent::configure();
41 5
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46 3
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
47
    {
48 3
        $encodingId = $input->getArgument('encoding-id');
49 3
        $encoding = new Encoding();
50 3
        $encoding->setId($encodingId);
51 3
        $this->getCloud($input)->deleteEncoding($encoding);
52 1
        $output->writeln(
53 1
            '<info>Successfully deleted encoding with id '.$encodingId.'</info>'
54
        );
55 1
    }
56
}
57