Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6
This commit is contained in:
parent
db56c09587
commit
f1e72395cb
588 changed files with 26857 additions and 2777 deletions
104
vendor/symfony/console/Style/SymfonyStyle.php
vendored
104
vendor/symfony/console/Style/SymfonyStyle.php
vendored
|
@ -65,40 +65,10 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$messages = is_array($messages) ? array_values($messages) : array($messages);
|
||||
$lines = array();
|
||||
|
||||
// add type
|
||||
if (null !== $type) {
|
||||
$messages[0] = sprintf('[%s] %s', $type, $messages[0]);
|
||||
}
|
||||
|
||||
// wrap and add newlines for each element
|
||||
foreach ($messages as $key => $message) {
|
||||
$message = OutputFormatter::escape($message);
|
||||
$lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true)));
|
||||
|
||||
if (count($messages) > 1 && $key < count($messages) - 1) {
|
||||
$lines[] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($padding && $this->isDecorated()) {
|
||||
array_unshift($lines, '');
|
||||
$lines[] = '';
|
||||
}
|
||||
|
||||
foreach ($lines as &$line) {
|
||||
$line = sprintf('%s%s', $prefix, $line);
|
||||
$line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
|
||||
|
||||
if ($style) {
|
||||
$line = sprintf('<%s>%s</>', $style, $line);
|
||||
}
|
||||
}
|
||||
|
||||
$this->writeln($lines);
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
|
@ -109,7 +79,7 @@ class SymfonyStyle extends OutputStyle
|
|||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln(array(
|
||||
sprintf('<comment>%s</>', $message),
|
||||
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
|
||||
));
|
||||
$this->newLine();
|
||||
|
@ -122,7 +92,7 @@ class SymfonyStyle extends OutputStyle
|
|||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln(array(
|
||||
sprintf('<comment>%s</>', $message),
|
||||
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
|
||||
));
|
||||
$this->newLine();
|
||||
|
@ -156,16 +126,17 @@ class SymfonyStyle extends OutputStyle
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Formats a command comment.
|
||||
*
|
||||
* @param string|array $message
|
||||
*/
|
||||
public function comment($message)
|
||||
{
|
||||
$this->autoPrependText();
|
||||
|
||||
$messages = is_array($message) ? array_values($message) : array($message);
|
||||
foreach ($messages as $message) {
|
||||
$this->writeln(sprintf(' // %s', $message));
|
||||
}
|
||||
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,12 +184,13 @@ class SymfonyStyle extends OutputStyle
|
|||
*/
|
||||
public function table(array $headers, array $rows)
|
||||
{
|
||||
$headers = array_map(function ($value) { return sprintf('<info>%s</>', $value); }, $headers);
|
||||
$style = clone Table::getStyleDefinition('symfony-style-guide');
|
||||
$style->setCellHeaderFormat('<info>%s</info>');
|
||||
|
||||
$table = new Table($this);
|
||||
$table->setHeaders($headers);
|
||||
$table->setRows($rows);
|
||||
$table->setStyle('symfony-style-guide');
|
||||
$table->setStyle($style);
|
||||
|
||||
$table->render();
|
||||
$this->newLine();
|
||||
|
@ -412,4 +384,52 @@ class SymfonyStyle extends OutputStyle
|
|||
return substr($value, -4);
|
||||
}, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
|
||||
}
|
||||
|
||||
private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
|
||||
{
|
||||
$indentLength = 0;
|
||||
$prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
|
||||
$lines = array();
|
||||
|
||||
if (null !== $type) {
|
||||
$type = sprintf('[%s] ', $type);
|
||||
$indentLength = strlen($type);
|
||||
$lineIndentation = str_repeat(' ', $indentLength);
|
||||
}
|
||||
|
||||
// wrap and add newlines for each element
|
||||
foreach ($messages as $key => $message) {
|
||||
if ($escape) {
|
||||
$message = OutputFormatter::escape($message);
|
||||
}
|
||||
|
||||
$lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
|
||||
|
||||
if (count($messages) > 1 && $key < count($messages) - 1) {
|
||||
$lines[] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$firstLineIndex = 0;
|
||||
if ($padding && $this->isDecorated()) {
|
||||
$firstLineIndex = 1;
|
||||
array_unshift($lines, '');
|
||||
$lines[] = '';
|
||||
}
|
||||
|
||||
foreach ($lines as $i => &$line) {
|
||||
if (null !== $type) {
|
||||
$line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
|
||||
}
|
||||
|
||||
$line = $prefix.$line;
|
||||
$line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
|
||||
|
||||
if ($style) {
|
||||
$line = sprintf('<%s>%s</>', $style, $line);
|
||||
}
|
||||
}
|
||||
|
||||
return $lines;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue