Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InteractiveCollector.php
Go to the documentation of this file.
1 <?php
7 
8 use Symfony\Component\Console\Input\InputInterface;
9 use Symfony\Component\Console\Output\OutputInterface;
10 use Symfony\Component\Console\Question\QuestionFactory;
11 use Symfony\Component\Console\Helper\QuestionHelper;
12 
17 {
21  private $questionFactory;
22 
26  private $questionHelper;
27 
32  public function __construct(
33  QuestionFactory $questionFactory,
34  QuestionHelper $questionHelper
35  ) {
36  $this->questionFactory = $questionFactory;
37  $this->questionHelper = $questionHelper;
38  }
39 
54  public function getValues(InputInterface $input, OutputInterface $output, array $configPaths)
55  {
56  $output->writeln('<info>Please set configuration values or skip them by pressing [Enter]:</info>');
57  $values = [];
58  foreach ($configPaths as $configPath) {
59  $question = $this->questionFactory->create([
60  'question' => $configPath . ': '
61  ]);
62  $values[$configPath] = $this->questionHelper->ask($input, $output, $question);
63  }
64 
65  return $values;
66  }
67 }
$values
Definition: options.phtml:88
__construct(QuestionFactory $questionFactory, QuestionHelper $questionHelper)
getValues(InputInterface $input, OutputInterface $output, array $configPaths)