Completed
Push — master ( 55a9c0...ed128c )
by Emil
14:56
created

PruneCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 5 1
A execute() 0 10 2
1
<?php
2
3
namespace Glooby\TaskBundle\Command\Scheduler;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * @author Emil Kilhage
12
 */
13
class PruneCommand extends ContainerAwareCommand
14
{
15
    /**
16
     * Configures the current command.
17
     */
18
    protected function configure()
19
    {
20
        $this->setName('scheduler:prune');
21
        $this->addOption('all', 'A', InputOption::VALUE_NONE);
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29
        $pruner = $this->getContainer()->get('glooby_task.queue_pruner');
30
31
        if ($input->getOption('all')) {
32
            $pruner->all();
33
        } else {
34
            $pruner->run();
35
        }
36
    }
37
}
38