Completed
Push — symfony-5 ( 5d6114...fa4e1a )
by Christian
03:47
created

DeleteProfileCommand::configure()   A

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\Profile;
18
19
/**
20
 * Command to delete a profile.
21
 *
22
 * @author Christian Flothmann <[email protected]>
23
 *
24
 * @final since 1.5
25
 */
26
class DeleteProfileCommand extends CloudCommand
27
{
28
    protected static $defaultName = 'panda:profile:delete';
29
30
    /**
31
     * {@inheritDoc}
32
     */
33 4
    protected function configure()
34
    {
35 4
        $this->setDescription('Delete a profile');
36 4
        $this->addArgument(
37 4
            'profile-id',
38 4
            InputArgument::REQUIRED,
39 4
            'Id of the profile'
40
        );
41
42 4
        parent::configure();
43 4
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48 3
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
49
    {
50 3
        $profile = new Profile();
51 3
        $profile->setId($input->getArgument('profile-id'));
52 3
        $this->getCloud($input)->deleteProfile($profile);
53 1
        $output->writeln(
54 1
            '<info>Successfully deleted profile '.$profile->getName().'</info>'
55
        );
56 1
    }
57
}
58