|
6 | 6 | use PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper;
|
7 | 7 | use PHPCR\Util\Console\Helper\PhpcrHelper;
|
8 | 8 | use Symfony\Component\Console\Command\Command;
|
| 9 | +use Symfony\Component\Console\Helper\DialogHelper; |
| 10 | +use Symfony\Component\Console\Helper\QuestionHelper; |
9 | 11 | use Symfony\Component\Console\Input\InputInterface;
|
10 | 12 | use Symfony\Component\Console\Output\OutputInterface;
|
11 | 13 | use Symfony\Component\Console\Question\ConfirmationQuestion;
|
@@ -51,40 +53,50 @@ protected function getPhpcrConsoleDumperHelper()
|
51 | 53 | *
|
52 | 54 | * @param InputInterface $input
|
53 | 55 | * @param OutputInterface $output
|
54 |
| - * @param string $question |
| 56 | + * @param string $questionText |
55 | 57 | * @param string $default
|
56 | 58 | *
|
57 | 59 | * @return string
|
58 | 60 | */
|
59 |
| - protected function ask(InputInterface $input, OutputInterface $output, $question, $default = null) |
| 61 | + protected function ask(InputInterface $input, OutputInterface $output, $questionText, $default = null) |
60 | 62 | {
|
61 | 63 | if ($this->getHelperSet()->has('question')) {
|
62 |
| - $question = new Question($question, $default); |
| 64 | + $question = new Question($questionText, $default); |
63 | 65 |
|
64 |
| - return $this->getHelper('question')->ask($input, $output, $question); |
| 66 | + return $this->getQuestionHelper()->ask($input, $output, $question); |
65 | 67 | }
|
66 | 68 |
|
67 |
| - return $this->getHelper('dialog')->ask($output, $question, $default); |
| 69 | + return $this->getDialogHelper()->ask($output, $questionText, $default); |
68 | 70 | }
|
69 | 71 |
|
70 | 72 | /**
|
71 | 73 | * Ask for confirmation with the question helper or the dialog helper for symfony < 2.5 compatibility.
|
72 | 74 | *
|
73 | 75 | * @param InputInterface $input
|
74 | 76 | * @param OutputInterface $output
|
75 |
| - * @param string $question |
| 77 | + * @param string $questionText |
76 | 78 | * @param bool $default
|
77 | 79 | *
|
78 | 80 | * @return string
|
79 | 81 | */
|
80 |
| - protected function askConfirmation(InputInterface $input, OutputInterface $output, $question, $default = true) |
| 82 | + protected function askConfirmation(InputInterface $input, OutputInterface $output, $questionText, $default = true) |
81 | 83 | {
|
82 | 84 | if ($this->getHelperSet()->has('question')) {
|
83 |
| - $question = new ConfirmationQuestion($question, $default); |
| 85 | + $question = new ConfirmationQuestion($questionText, $default); |
84 | 86 |
|
85 |
| - return $this->getHelper('question')->ask($input, $output, $question); |
| 87 | + return $this->getQuestionHelper()->ask($input, $output, $question); |
86 | 88 | }
|
87 | 89 |
|
88 |
| - return $this->getHelper('dialog')->askConfirmation($output, $question, $default); |
| 90 | + return $this->getDialogHelper()->askConfirmation($output, $questionText, $default); |
| 91 | + } |
| 92 | + |
| 93 | + private function getQuestionHelper(): QuestionHelper |
| 94 | + { |
| 95 | + return $this->getHelper('question'); |
| 96 | + } |
| 97 | + |
| 98 | + private function getDialogHelper(): DialogHelper |
| 99 | + { |
| 100 | + return $this->getHelper('dialog'); |
89 | 101 | }
|
90 | 102 | }
|
0 commit comments