本文整理匯總了PHP中Symfony\Component\Console\Helper\DialogHelper::setInput方法的典型用法代碼示例。如果您正苦於以下問題:PHP DialogHelper::setInput方法的具體用法?PHP DialogHelper::setInput怎麽用?PHP DialogHelper::setInput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Helper\DialogHelper
的用法示例。
在下文中一共展示了DialogHelper::setInput方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initialize
/**
* @param InputInterface $input
* @param OutputInterface $output
* @SuppressWarnings(PHPMD.ExitExpression)
*/
protected function initialize(InputInterface $input, OutputInterface $output)
{
parent::initialize($input, $output);
$this->dialog = $this->getApplication()->getDialogHelper();
$this->filesystem = new Filesystem();
if ($input->isInteractive()) {
return;
}
// if the qa-tools.json of a full previous run are loaded, we support the --no-interaction (-n) flag.
// This is achieved by making the dialog input-aware, see \Symfony\Console\Helper\DialogHelper::ask()
// lines 101-103 and \Symfony\Console\Helper\InputAwareHelper
if (!$this->settings->hasLoadedJsonFile() || !$this->settings->previousRunWasCompleted()) {
$output->writeln('<error>Previous run was not completed fully, cannot run in non-interactive mode</error>');
// stop with error
exit(1);
}
$this->dialog->setInput($input);
}
示例2: testNoInteraction
public function testNoInteraction()
{
$dialog = new DialogHelper();
$input = new ArrayInput(array());
$input->setInteractive(false);
$dialog->setInput($input);
$this->assertEquals('not yet', $dialog->ask($this->getOutputStream(), 'Do you have a job?', 'not yet'));
}