Completed
Pull Request — master (#59)
by Julien
02:49
created

AbstractQuestion   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A spacer() 0 3 1
A __construct() 0 7 1
1
<?php
2
3
namespace TheAentMachine\Question;
4
5
use Symfony\Component\Console\Helper\QuestionHelper;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
abstract class AbstractQuestion
10
{
11
    /** @var QuestionHelper */
12
    protected $helper;
13
14
    /** @var InputInterface */
15
    protected $input;
16
17
    /** @var OutputInterface */
18
    protected $output;
19
20
    /** @var string */
21
    protected $question;
22
23
    /** @var string|null */
24
    protected $default;
25
26
    /** @var string|null */
27
    protected $helpText;
28
29
    /** @var bool */
30
    protected $printAnswer;
31
32
    public function __construct(InputInterface $input, OutputInterface $output, QuestionHelper $helper, string $question, bool $printAnswer = true)
33
    {
34
        $this->helper = $helper;
35
        $this->input = $input;
36
        $this->output = $output;
37
        $this->question = $question;
38
        $this->printAnswer = $printAnswer;
39
    }
40
41
    protected function spacer(): void
42
    {
43
        $this->output->writeln('');
44
    }
45
46
    /**
47
     * @param string $default
48
     * @return mixed
49
     */
50
    abstract public function setDefault(string $default);
51
52
    /**
53
     * @param string $helpText
54
     * @return mixed
55
     */
56
    abstract public function setHelpText(string $helpText);
57
58
    /**
59
     * @return mixed
60
     */
61
    abstract public function ask();
62
}
63