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

AbstractSequence   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 9
c 1
b 0
f 0
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A whiteFooter() 0 4 2
A writeHeader() 0 4 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 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