Completed
Push — master ( c2e487...7ac6a5 )
by Wachter
07:39
created

RunCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Task\TaskBundle\Command;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Task\SchedulerInterface;
9
10
/**
11
 * Run pending tasks.
12
 *
13
 * @author @wachterjohannes <[email protected]>
14
 */
15
class RunCommand extends Command
16
{
17
    /**
18
     * @var SchedulerInterface
19
     */
20
    private $scheduler;
21
22 2
    public function __construct(SchedulerInterface $scheduler)
23
    {
24 2
        parent::__construct('task:run');
25
26 2
        $this->scheduler = $scheduler;
27 2
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 2
    protected function configure()
33
    {
34 2
        $this->setDescription('Run pending tasks');
35 2
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    protected function execute(InputInterface $input, OutputInterface $output)
41
    {
42 1
        $this->scheduler->run();
43 1
    }
44
}
45