Completed
Push — master ( 3c97bc...1ea994 )
by Emil
15s queued 12s
created

PruneCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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
use Symfony\Component\DependencyInjection\ContainerInterface;
10
11
/**
12
 * @author Emil Kilhage
13
 */
14
class PruneCommand extends ContainerAwareCommand
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...d\ContainerAwareCommand has been deprecated with message: since Symfony 4.2, use {@see Command} instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
15
{
16
    private $container;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
17
18
    public function __construct(ContainerInterface $container){
19
        parent::__construct();
20
        $this->container = $container;
21
    }
22
23
    /**
24
     * Configures the current command.
25
     */
26
    protected function configure()
27
    {
28
        $this->setName('scheduler:prune');
29
        $this->addOption('all', 'A', InputOption::VALUE_NONE);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        $pruner =$this->container->get('glooby_task.queue_pruner');
38
39
        if ($input->getOption('all')) {
40
            $pruner->all();
41
        } else {
42
            $pruner->run();
43
        }
44
    }
45
}
46