Passed
Pull Request — master (#400)
by Théo
03:09
created

IO::getInput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the box project.
7
 *
8
 * (c) Kevin Herrera <[email protected]>
9
 *     Théo Fidry <[email protected]>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14
15
namespace KevinGH\Box\Console\IO;
16
17
use Symfony\Component\Console\Input\InputInterface;
18
use Symfony\Component\Console\Input\StringInput;
19
use Symfony\Component\Console\Output\NullOutput;
20
use Symfony\Component\Console\Output\OutputInterface;
21
use Symfony\Component\Console\Style\SymfonyStyle;
22
23
final class IO extends SymfonyStyle
24
{
25
    private $input;
26
    private $output;
27
28
    public static function createNull(): self
29
    {
30
        return new self(
31
            new StringInput(''),
32
            new NullOutput()
33
        );
34
    }
35
36
    public function __construct(InputInterface $input, OutputInterface $output)
37
    {
38
        parent::__construct($input, $output);
39
40
        $this->input = $input;
41
        $this->output = $output;
42
    }
43
44
    public function getInput(): InputInterface
45
    {
46
        return $this->input;
47
    }
48
49
    public function isInteractive(): bool
50
    {
51
        return $this->input->isInteractive();
52
    }
53
54
    public function getOutput(): OutputInterface
55
    {
56
        return $this->output;
57
    }
58
}
59