Completed
Push — master ( ed128c...8b5779 )
by Emil
09:14
created

PruneCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
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