Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
19
vendor/symfony/console/Helper/QuestionHelper.php
vendored
19
vendor/symfony/console/Helper/QuestionHelper.php
vendored
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
@ -38,7 +40,7 @@ class QuestionHelper extends Helper
|
|||
*
|
||||
* @return string The user answer
|
||||
*
|
||||
* @throws \RuntimeException If there is no data to read in the input stream
|
||||
* @throws RuntimeException If there is no data to read in the input stream
|
||||
*/
|
||||
public function ask(InputInterface $input, OutputInterface $output, Question $question)
|
||||
{
|
||||
|
@ -70,12 +72,12 @@ class QuestionHelper extends Helper
|
|||
*
|
||||
* @param resource $stream The input stream
|
||||
*
|
||||
* @throws \InvalidArgumentException In case the stream is not a resource
|
||||
* @throws InvalidArgumentException In case the stream is not a resource
|
||||
*/
|
||||
public function setInputStream($stream)
|
||||
{
|
||||
if (!is_resource($stream)) {
|
||||
throw new \InvalidArgumentException('Input stream must be a valid resource.');
|
||||
throw new InvalidArgumentException('Input stream must be a valid resource.');
|
||||
}
|
||||
|
||||
$this->inputStream = $stream;
|
||||
|
@ -162,11 +164,12 @@ class QuestionHelper extends Helper
|
|||
$message = $question->getQuestion();
|
||||
|
||||
if ($question instanceof ChoiceQuestion) {
|
||||
$width = max(array_map('strlen', array_keys($question->getChoices())));
|
||||
$maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
|
||||
|
||||
$messages = (array) $question->getQuestion();
|
||||
foreach ($question->getChoices() as $key => $value) {
|
||||
$messages[] = sprintf(" [<info>%-${width}s</info>] %s", $key, $value);
|
||||
$width = $maxWidth - $this->strlen($key);
|
||||
$messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
|
||||
}
|
||||
|
||||
$output->writeln($messages);
|
||||
|
@ -319,7 +322,7 @@ class QuestionHelper extends Helper
|
|||
*
|
||||
* @return string The answer
|
||||
*
|
||||
* @throws \RuntimeException In case the fallback is deactivated and the response cannot be hidden
|
||||
* @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
|
||||
*/
|
||||
private function getHiddenResponse(OutputInterface $output, $inputStream)
|
||||
{
|
||||
|
@ -351,7 +354,7 @@ class QuestionHelper extends Helper
|
|||
shell_exec(sprintf('stty %s', $sttyMode));
|
||||
|
||||
if (false === $value) {
|
||||
throw new \RuntimeException('Aborted');
|
||||
throw new RuntimeException('Aborted');
|
||||
}
|
||||
|
||||
$value = trim($value);
|
||||
|
@ -369,7 +372,7 @@ class QuestionHelper extends Helper
|
|||
return $value;
|
||||
}
|
||||
|
||||
throw new \RuntimeException('Unable to hide the response.');
|
||||
throw new RuntimeException('Unable to hide the response.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue