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

DeleteVideoCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
cbo 5
dl 0
loc 30
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 11 1
A doExecuteCommand() 0 8 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 since 1.5
25
 */
26
class DeleteVideoCommand extends CloudCommand
27
{
28
    protected static $defaultName = 'panda:video:delete';
29
    /**
30
     * {@inheritDoc}
31
     */
32
    protected function configure()
33
    {
34
        $this->setDescription('Delete a video');
35
        $this->addArgument(
36
            'video-id',
37
            InputArgument::REQUIRED,
38
            'Id of the video'
39
        );
40
41
        parent::configure();
42
    }
43
44
    /**
45
     * {@inheritDoc}
46
     */
47
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
48
    {
49
        $videoId = $input->getArgument('video-id');
50
        $video = new Video();
51
        $video->setId($videoId);
52
        $this->getCloud($input)->deleteVideo($video);
53
        $output->writeln('<info>Successfully deleted video with id '.$videoId.'</info>');
54
    }
55
}
56