Passed
Push — master ( ed42e4...b3b06a )
by Kirill
04:44
created

CommandSequence::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Console\Sequence;
13
14
use Psr\Container\ContainerInterface;
15
use Spiral\Console\Console;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
/**
19
 * Executes command as part of the sequence.
20
 */
21
final class CommandSequence extends AbstractSequence
22
{
23
    /** @var string */
24
    private $command;
25
26
    /** @var array */
27
    private $options = [];
28
29
    /**
30
     * @param string $command
31
     * @param array  $options
32
     * @param string $header
33
     * @param string $footer
34
     */
35
    public function __construct(
36
        string $command,
37
        array $options = [],
38
        string $header = '',
39
        string $footer = ''
40
    ) {
41
        $this->command = $command;
42
        $this->options = $options;
43
44
        parent::__construct($header, $footer);
45
    }
46
47
    /**
48
     * @inheritdoc
49
     */
50
    public function execute(ContainerInterface $container, OutputInterface $output): void
51
    {
52
        /** @var Console $console */
53
        $console = $container->get(Console::class);
54
55
        $console->run($this->command, $this->options, $output);
56
    }
57
}
58