Passed
Push — master ( b89ee9...82ea21 )
by Sebastian
03:18
created

Command   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setIO() 0 3 1
A getIO() 0 6 2
1
<?php
2
3
/**
4
 * This file is part of CaptainHook
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Console;
13
14
use Symfony\Component\Console\Command\Command as SymfonyCommand;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
/**
19
 * Class Command
20
 *
21
 * @package CaptainHook
22
 * @author  Sebastian Feldmann <[email protected]>
23
 * @link    https://github.com/captainhookphp/captainhook
24
 * @since   Class available since Release 5.0.0
25
 */
26
abstract class Command extends SymfonyCommand
27
{
28
    /**
29
     * Input output handler
30
     *
31
     * @var \CaptainHook\App\Console\IO
32
     */
33
    private $io;
34
35
    /**
36
     * IO setter
37
     *
38
     * @param \CaptainHook\App\Console\IO $io
39
     */
40
    public function setIO(IO $io): void
41
    {
42
        $this->io = $io;
43
    }
44
45
    /**
46
     * IO interface getter
47
     *
48
     * @param  \Symfony\Component\Console\Input\InputInterface   $input
49
     * @param  \Symfony\Component\Console\Output\OutputInterface $output
50
     * @return \CaptainHook\App\Console\IO
51
     */
52
    public function getIO(InputInterface $input, OutputInterface $output): IO
53
    {
54
        if (null === $this->io) {
55
            $this->io = new IO\DefaultIO($input, $output, $this->getHelperSet());
56
        }
57
        return $this->io;
58
    }
59
}
60