Completed
Push — master ( af7781...a68919 )
by David
02:50
created

ExpireCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A action() 0 7 1
A configure() 0 12 1
1
<?php
2
3
namespace Terox\SubscriptionBundle\Command;
4
5
use Symfony\Component\Console\Input\InputArgument;
6
use Terox\SubscriptionBundle\Model\SubscriptionInterface;
7
use Terox\SubscriptionBundle\TeroxSubscriptionBundle;
8
9
class ExpireCommand extends AbstractCommand
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 1
    protected function configure()
15
    {
16 1
        parent::configure();
17
18
        $this
19 1
            ->setName(TeroxSubscriptionBundle::COMMAND_NAMESPACE.':expire')
20 1
            ->setDescription('Expire a subscription')
21 1
            ->addArgument(
22 1
                'reason',
23 1
                InputArgument::OPTIONAL,
24 1
                'Reason of expiration',
25 1
                'expired'
26
            );
27 1
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    protected function action(SubscriptionInterface $subscription)
33
    {
34 1
        $reason = $this->input->getArgument('reason');
35
36 1
        $this->getManager()->expire($subscription, $reason);
37
38 1
        $this->output->writeln(sprintf('Expired subscription'));
39 1
    }
40
}
41