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

AbstractSequence::writeHeader()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
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 4
rs 10
cc 2
nc 2
nop 1
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 Spiral\Console\SequenceInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
abstract class AbstractSequence implements SequenceInterface
18
{
19
    /** @var string */
20
    private $header;
21
22
    /** @var string */
23
    private $footer;
24
25
    /**
26
     * @param string $header
27
     * @param string $footer
28
     */
29
    public function __construct(string $header, string $footer)
30
    {
31
        $this->header = $header;
32
        $this->footer = $footer;
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function writeHeader(OutputInterface $output): void
39
    {
40
        if (!empty($this->header)) {
41
            $output->writeln($this->header);
42
        }
43
    }
44
45
    /**
46
     * @inheritdoc
47
     */
48
    public function whiteFooter(OutputInterface $output): void
49
    {
50
        if (!empty($this->footer)) {
51
            $output->writeln($this->footer);
52
        }
53
    }
54
}
55