1 | <?php |
||
12 | trait QuestionHelperTrait { |
||
13 | |||
14 | /** |
||
15 | * Build text for asking a question. For example: |
||
16 | * |
||
17 | * "Do you want to continue [yes]:" |
||
18 | * |
||
19 | * @param string $question The question you want to ask |
||
20 | * @param mixed $default Default value to add to message, if false no default will be shown |
||
21 | * @param string $sep Separation char for between message and user input |
||
22 | * |
||
23 | * @return string |
||
24 | */ |
||
25 | protected function getQuestion($question, $default = null, $sep = ':') { |
||
30 | |||
31 | /** |
||
32 | * @return HelperSet |
||
33 | */ |
||
34 | abstract protected function getHelperSet(); |
||
35 | |||
36 | private $dialog; |
||
37 | |||
38 | /** |
||
39 | * |
||
40 | * @param Question $question |
||
41 | * @return string the answer |
||
42 | */ |
||
43 | private function ask(Question $question) { |
||
51 | |||
52 | /** |
||
53 | * Asks a question |
||
54 | * |
||
55 | * @param Question $question |
||
56 | * @return string the answer |
||
57 | */ |
||
58 | protected function askQuestion(Question $question) { |
||
65 | |||
66 | /** |
||
67 | * Asks a confirmation question |
||
68 | * |
||
69 | * @param ConfirmationQuestion $question |
||
70 | * @return string the answer |
||
71 | */ |
||
72 | protected function askConfirmation(ConfirmationQuestion $question) { |
||
77 | |||
78 | } |