You are here

public function SymfonyStyle::choice in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/console/Style/SymfonyStyle.php \Symfony\Component\Console\Style\SymfonyStyle::choice()

Asks a choice question.

Parameters

string $question:

array $choices:

string|int|null $default:

Return value

string

Overrides StyleInterface::choice

File

vendor/symfony/console/Style/SymfonyStyle.php, line 253

Class

SymfonyStyle
Output decorator helpers for the Symfony Style Guide.

Namespace

Symfony\Component\Console\Style

Code

public function choice($question, array $choices, $default = null) {
  if (null !== $default) {
    $values = array_flip($choices);
    $default = $values[$default];
  }
  return $this
    ->askQuestion(new ChoiceQuestion($question, $choices, $default));
}