DeleteProfileCommand::doExecuteCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\Profile;
18
19
/**
20
 * Command to delete a profile.
21
 *
22
 * @author Christian Flothmann <[email protected]>
23
 */
24
final class DeleteProfileCommand extends CloudCommand
25
{
26
    protected static $defaultName = 'panda:profile:delete';
27
28
    /**
29
     * {@inheritDoc}
30
     */
31 5
    protected function configure()
32
    {
33 5
        $this->setDescription('Delete a profile');
34 5
        $this->addArgument(
35 5
            'profile-id',
36 5
            InputArgument::REQUIRED,
37 5
            'Id of the profile'
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
        $profile = new Profile();
49 3
        $profile->setId($input->getArgument('profile-id'));
50 3
        $this->getCloud($input)->deleteProfile($profile);
51 1
        $output->writeln(
52 1
            '<info>Successfully deleted profile '.$profile->getName().'</info>'
53
        );
54 1
    }
55
}
56