LongTasksCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Acelaya\Website\Console\Command;
5
6
use Acelaya\Website\Console\Task\LongTaskInterface;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class LongTasksCommand extends Command
12
{
13
    /**
14
     * @var LongTaskInterface[]
15
     */
16
    protected $tasks;
17
18
    /**
19
     * LongTasksCommand constructor.
20
     * @param LongTaskInterface[] $tasks
21
     */
22
    public function __construct(array $tasks)
23
    {
24
        parent::__construct(null);
25
        $this->tasks = $tasks;
26
    }
27
28
    public function configure()
29
    {
30
        $this->setName('website:long-tasks')
31
             ->setDescription('Runs all the preconfigured long tasks');
32
    }
33
34
    public function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        foreach ($this->tasks as $task) {
37
            $task->run($input, $output);
38
        }
39
    }
40
}
41