本文整理汇总了PHP中Symfony\Component\Console\Helper\HelperSet::get方法的典型用法代码示例。如果您正苦于以下问题:PHP HelperSet::get方法的具体用法?PHP HelperSet::get怎么用?PHP HelperSet::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Helper\HelperSet
的用法示例。
在下文中一共展示了HelperSet::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ask
/**
* {@inheritdoc}
*/
public function ask($question, $default = NULL)
{
/** @var QuestionHelper $helper */
$helper = $this->helperSet->get('question');
$question = new ConfirmationQuestion($question, $default);
return $helper->ask($this->input, $this->output, $question);
}
示例2: getPrompter
/**
* @return \PhpSpec\Console\Prompter
*/
public function getPrompter()
{
if ($this->helperSet->has('question')) {
return new Question($this->input, $this->output, $this->helperSet->get('question'));
}
return new Dialog($this->output, $this->helperSet->get('dialog'));
}
示例3: ask
/**
* @param string $question
* @param null $default
*
* @return string
*/
protected function ask($question, $default = null)
{
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
$helper = $this->helperSet->get('question');
$question = new Question($question, $default);
return $helper->ask($this->input, $this->getErrorOutput(), $question);
}
示例4: chosen
/**
* read the input and return a Configuration, returns `false` if the config
* is not supported
* @return Connection|null
*/
public function chosen()
{
if ($this->helperSet->has($this->helperName)) {
$connectionHelper = $this->helperSet->get($this->helperName);
if ($connectionHelper instanceof ConnectionHelper) {
return $connectionHelper->getConnection();
}
}
return null;
}
示例5: ask
/**
* {@inheritdoc}
*/
public function ask($question, $default = NULL)
{
if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_QUIET) {
return FALSE;
}
/** @var QuestionHelper $helper */
$helper = $this->helperSet->get('question');
$question = new ConfirmationQuestion($question, $default);
return $helper->ask($this->input, $this->output, $question);
}
示例6: createCommand
/**
* @param HelperSet $helpers
* @return TravisCiCommand
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException
* @throws \Symfony\Component\Console\Exception\LogicException
*/
public static function createCommand(HelperSet $helpers)
{
/** @var QuestionHelper $questionHelper */
$questionHelper = $helpers->get('question');
$travisCiQuestionHelper = new TravisCiQuestionHelper($questionHelper);
/** @var PackageHelper $packageHelper */
$packageHelper = $helpers->get('package');
$configBuilder = new ConfigBuilder($travisCiQuestionHelper, $packageHelper);
$configWriter = new ConfigWriter();
return new TravisCiCommand($travisCiQuestionHelper, $configBuilder, $configWriter);
}
示例7: ArrayInput
function it_should_execute_when_calling_fire_action(QuestionHelper $question, HelperSet $helpers)
{
$helpers->get('question')->willReturn($question);
$input = new ArrayInput([]);
$output = new NullOutput();
$query = Argument::type('Symfony\\Component\\Console\\Question\\ChoiceQuestion');
$question->ask($input, $output, $query)->willReturn(1);
$helpers->get('question')->willReturn($question);
$this->setHelperSet($helpers);
$this->run($input, $output);
$this->fire();
}
示例8: select
/**
* {@inheritDoc}
*/
public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
{
if ($this->isInteractive()) {
return $this->helperSet->get('dialog')->select($this->getErrorOutput(), $question, $choices, $default, $attempts, $errorMessage, $multiselect);
}
return $default;
}
示例9: choose
/**
* Asks user to choose.
*
* @param string $question The question to ask.
* @param array $options Valid answer options.
* @param mixed $default Default answer.
* @param string $error_message Error on incorrect answer.
*
* @return mixed
*/
public function choose($question, array $options, $default, $error_message)
{
/** @var QuestionHelper $helper */
$helper = $this->_helperSet->get('question');
$choice_question = new ChoiceQuestion('<question>' . $question . '</question> ', $options, $default);
$choice_question->setErrorMessage($error_message);
return $helper->ask($this->_input, $this->_output, $choice_question);
}
示例10:
function it_dumps_field_filters(OutputInterface $output, HelperSet $helperSet, TableHelper $table)
{
$output->writeln(Argument::any())->shouldBeCalled();
$helperSet->get('table')->willReturn($table);
$headers = ['field', 'filter_class', 'operators'];
$table->setHeaders($headers)->shouldBeCalled()->willReturn($table);
$table->setRows(Argument::any())->shouldBeCalled();
$table->render(Argument::any())->shouldBeCalled();
$this->dump($output, $helperSet);
}
示例11:
function it_dumps_field_filters(OutputInterface $output, HelperSet $helperSet, TableHelper $table, $repository)
{
$output->writeln(Argument::any())->shouldBeCalled();
$repository->findAll()->willReturn([]);
$helperSet->get('table')->willReturn($table);
$headers = ['attribute', 'localizable', 'scopable', 'attribute type', 'filter_class', 'operators'];
$table->setHeaders($headers)->shouldBeCalled()->willReturn($table);
$table->setRows(Argument::any())->shouldBeCalled();
$table->render(Argument::any())->shouldBeCalled();
$this->dump($output, $helperSet);
}
示例12: NullOutput
function it_should_execute_when_calling_fire_action(QuestionHelper $question, HelperSet $helpers)
{
$app = Mockery::mock('Illuminate\\Contracts\\Foundation\\Application');
$app->shouldReceive('call')->andReturn(true);
$input = Mockery::mock('Symfony\\Component\\Console\\Input\\ArrayInput');
$input->shouldReceive('bind');
$input->shouldReceive('isInteractive')->andReturn(false);
$input->shouldReceive('hasArgument')->andReturn(false);
$input->shouldReceive('validate')->andReturn(false);
$input->shouldReceive('getOption')->andReturn(false);
$this->setLaravel($app);
$helpers->get('question')->willReturn($question);
$output = new NullOutput();
$query = Argument::type('Symfony\\Component\\Console\\Question\\ChoiceQuestion');
$question->ask($input, $output, $query)->willReturn(1);
$helpers->get('question')->willReturn($question);
$this->setHelperSet($helpers);
$this->run($input, $output);
$this->fire();
}
示例13: yes
/**
* If the user answers yes then we can override the file
* or if the file doesn't exist then we will just answer
* yes because we aren't overriding anything.
*
* @param string $filename
* @param OutputInterface $output
* @param HelperSet $helperSet
* @return boolean
*/
protected function yes($filename, $output, $helperSet, $options)
{
if (!$this->file->exists($this->basePath . '/' . $filename)) {
return true;
}
if (isset($options['yes']) && $options['yes'] == true) {
return true;
}
$dialog = $helperSet->get('dialog');
if ($dialog->askConfirmation($output, "<question>Would you like to override {$filename}? [y/N]</question>", false)) {
return true;
}
return false;
}
示例14: dump
/**
* {@inheritdoc}
*/
public function dump(OutputInterface $output, HelperSet $helperSet)
{
$output->writeln("<info>Useable attributes filters...</info>");
$attributeFilters = $this->getAttributeFilters();
$attributes = $this->repository->findAll();
$rows = [];
foreach ($attributes as $attribute) {
$rows = array_merge($rows, $this->getFilterInformationForAttribute($attribute, $attributeFilters));
}
$table = $helperSet->get('table');
$headers = ['attribute', 'localizable', 'scopable', 'attribute type', 'operators', 'filter_class'];
$table->setHeaders($headers)->setRows($rows);
$table->render($output);
}
示例15: dump
/**
* {@inheritdoc}
*/
public function dump(OutputInterface $output, HelperSet $helperSet)
{
$output->writeln("<info>Useable field filters...</info>");
$rows = [];
foreach ($this->registry->getFieldFilters() as $filter) {
$class = get_class($filter);
$operators = implode(', ', $filter->getOperators());
foreach ($filter->getFields() as $field) {
$rows[] = [$field, $operators, $class];
}
}
$headers = ['field', 'operators', 'filter_class'];
$table = $helperSet->get('table');
$table->setHeaders($headers)->setRows($rows);
$table->render($output);
}