DisableEventCommand::doExecuteCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 10
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\NotificationEvent;
18
use Xabbuh\PandaClient\Model\Notifications;
19
20
/**
21
 * Command for disabling notification events.
22
 *
23
 * @author Christian Flothmann <[email protected]>
24
 */
25
final class DisableEventCommand extends CloudCommand
26
{
27
    protected static $defaultName = 'panda:notifications:disable';
28
29
    /**
30
     * {@inheritDoc}
31
     */
32 4
    protected function configure()
33
    {
34 4
        $this->setDescription('Disable a notification event');
35 4
        $this->addArgument(
36 4
            'event',
37 4
            InputArgument::REQUIRED,
38 4
            'The event being disabled'
39
        );
40
41 4
        parent::configure();
42 4
    }
43
44
    /**
45
     * {@inheritDoc}
46
     */
47 2
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
48
    {
49 2
        $notificationEvent = new NotificationEvent($input->getArgument('event'), false);
50 2
        $notifications = new Notifications();
51 2
        $notifications->addNotificationEvent($notificationEvent);
52 2
        $this->getCloud($input)->setNotifications($notifications);
53 1
    }
54
}
55