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

DisableEventCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 5

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 11 1
A doExecuteCommand() 0 7 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 since 1.5
26
 */
27
class DisableEventCommand extends CloudCommand
28
{
29
    protected static $defaultName = 'panda:notifications:disable';
30
31
    /**
32
     * {@inheritDoc}
33
     */
34 3
    protected function configure()
35
    {
36 3
        $this->setDescription('Disable a notification event');
37 3
        $this->addArgument(
38 3
            'event',
39 3
            InputArgument::REQUIRED,
40 3
            'The event being disabled'
41
        );
42
43 3
        parent::configure();
44 3
    }
45
46
    /**
47
     * {@inheritDoc}
48
     */
49 2
    protected function doExecuteCommand(InputInterface $input, OutputInterface $output)
50
    {
51 2
        $notificationEvent = new NotificationEvent($input->getArgument('event'), false);
52 2
        $notifications = new Notifications();
53 2
        $notifications->addNotificationEvent($notificationEvent);
54 2
        $this->getCloud($input)->setNotifications($notifications);
55 1
    }
56
}
57