RunCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * This file is part of the Commander project.
4
 *
5
 * @author Daniel Schröder <[email protected]>
6
 */
7
8
namespace GravityMedia\Commander\Console\Command;
9
10
use GravityMedia\Commander\Commander\TaskRunner;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
/**
15
 * Run command class.
16
 *
17
 * @package GravityMedia\Commander\Console\Command
18
 */
19
class RunCommand extends Command
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected function configure()
25
    {
26
        parent::configure();
27
28
        $this
29
            ->setName('run')
30
            ->setDescription('Run all joined tasks');
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 2
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38 2
        $commander = $this->getCommander()->initialize();
39
40 2
        $taskManager = $commander->getTaskManager();
41 2
        $logger = $commander->getLogger();
42
43 2
        $taskRunner = new TaskRunner($taskManager, $output, $logger);
44 2
        $taskRunner->runAll($this->getConfiguration()->getProcessTimeout());
45 2
    }
46
}
47