Completed
Pull Request — master (#6)
by
unknown
01:11
created

RunCommand::__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\Output\OutputInterface;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
10
/**
11
 * @author Emil Kilhage
12
 */
13
class RunCommand 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...
14
{
15
    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...
16
17
    public function __construct(ContainerInterface $container){
18
        parent::__construct();
19
        $this->container = $container;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    protected function configure()
26
    {
27
        $this->setName('scheduler:run');
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        $runner = $this->container->get('glooby_task.queue_processor');
36
        $runner->setOutput($output);
37
        $runner->process();
38
39
        $monitor = $this->container->get('glooby_task.queue_monitor');
40
        $monitor->monitor();
41
42
        $scheduler = $this->container->get('glooby_task.queue_scheduler');
43
        $scheduler->schedule();
44
    }
45
}
46