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