ListNightlyTaskCommand::execute()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 0
cts 11
cp 0
rs 9.8333
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 12
1
<?php
2
3
namespace Dekalee\NightlyTaskBundle\Command;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * Class ListNightlyTaskCommand
11
 */
12
class ListNightlyTaskCommand extends AbstractNightlyTaskCommand
13
{
14
    /**
15
     * Configures the current command.
16
     */
17
    protected function configure()
18
    {
19
        $this->setName('dekalee:nightly:list')
20
            ->setDescription('List all the command that should run nightly');
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        $this->beforeExecute($input, $output);
29
        $this->fillTasks();
30
31
        foreach ($this->getTasks() as $priority => $taskPriority) {
32
            $output->writeln(sprintf('Priority : <comment>%d</comment>', $priority));
33
            /** @var Command $task */
34
            foreach ($taskPriority as $task) {
35
                $output->writeln(sprintf('%s<info>%s</info>', str_repeat(' ', 10), $task->getName()));
36
            }
37
        }
38
    }
39
}
40