Completed
Push — drop-container-aware-command ( 55eeca )
by Christian
02:20
created

CancelEncodingCommand::doExecuteCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 8
cp 0
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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 cancel an encoding.
21
 *
22
 * @author Christian Flothmann <[email protected]>
23
 *
24
 * @final since 1.5
25
 */
26
class CancelEncodingCommand extends CloudCommand
27
{
28
    protected static $defaultName = 'panda:encoding:cancel';
29
30
    /**
31
     * {@inheritDoc}
32
     */
33
    protected function configure()
34
    {
35
        $this->setDescription('Cancel an encoding');
36
        $this->addArgument(
37
            'encoding-id',
38
            InputArgument::REQUIRED,
39
            'Id of the encoding'
40
        );
41
42
        parent::configure();
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
49
    {
50
        $encodingId = $input->getArgument('encoding-id');
51
        $encoding = new Encoding();
52
        $encoding->setId($encodingId);
53
        $this->getCloud($input)->cancelEncoding($encoding);
54
        $output->writeln(
55
            '<info>Successfully canceled encoding with id '.$encodingId.'</info>'
56
        );
57
    }
58
}
59