Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
203
vendor/symfony/console/Helper/ProgressBar.php
vendored
203
vendor/symfony/console/Helper/ProgressBar.php
vendored
@@ -13,6 +13,7 @@ namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleSectionOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Terminal;
|
||||
|
||||
@@ -50,7 +51,7 @@ final class ProgressBar
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
* @param int $max Maximum steps (0 if unknown)
|
||||
*/
|
||||
public function __construct(OutputInterface $output, $max = 0)
|
||||
public function __construct(OutputInterface $output, int $max = 0)
|
||||
{
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$output = $output->getErrorOutput();
|
||||
@@ -79,7 +80,7 @@ final class ProgressBar
|
||||
* @param string $name The placeholder name (including the delimiter char like %)
|
||||
* @param callable $callable A PHP callable
|
||||
*/
|
||||
public static function setPlaceholderFormatterDefinition($name, callable $callable)
|
||||
public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void
|
||||
{
|
||||
if (!self::$formatters) {
|
||||
self::$formatters = self::initPlaceholderFormatters();
|
||||
@@ -95,7 +96,7 @@ final class ProgressBar
|
||||
*
|
||||
* @return callable|null A PHP callable
|
||||
*/
|
||||
public static function getPlaceholderFormatterDefinition($name)
|
||||
public static function getPlaceholderFormatterDefinition(string $name): ?callable
|
||||
{
|
||||
if (!self::$formatters) {
|
||||
self::$formatters = self::initPlaceholderFormatters();
|
||||
@@ -112,7 +113,7 @@ final class ProgressBar
|
||||
* @param string $name The format name
|
||||
* @param string $format A format string
|
||||
*/
|
||||
public static function setFormatDefinition($name, $format)
|
||||
public static function setFormatDefinition(string $name, string $format): void
|
||||
{
|
||||
if (!self::$formats) {
|
||||
self::$formats = self::initFormats();
|
||||
@@ -128,7 +129,7 @@ final class ProgressBar
|
||||
*
|
||||
* @return string|null A format string
|
||||
*/
|
||||
public static function getFormatDefinition($name)
|
||||
public static function getFormatDefinition(string $name): ?string
|
||||
{
|
||||
if (!self::$formats) {
|
||||
self::$formats = self::initFormats();
|
||||
@@ -147,102 +148,57 @@ final class ProgressBar
|
||||
* @param string $message The text to associate with the placeholder
|
||||
* @param string $name The name of the placeholder
|
||||
*/
|
||||
public function setMessage($message, $name = 'message')
|
||||
public function setMessage(string $message, string $name = 'message')
|
||||
{
|
||||
$this->messages[$name] = $message;
|
||||
}
|
||||
|
||||
public function getMessage($name = 'message')
|
||||
public function getMessage(string $name = 'message')
|
||||
{
|
||||
return $this->messages[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the progress bar start time.
|
||||
*
|
||||
* @return int The progress bar start time
|
||||
*/
|
||||
public function getStartTime()
|
||||
public function getStartTime(): int
|
||||
{
|
||||
return $this->startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the progress bar maximal steps.
|
||||
*
|
||||
* @return int The progress bar max steps
|
||||
*/
|
||||
public function getMaxSteps()
|
||||
public function getMaxSteps(): int
|
||||
{
|
||||
return $this->max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current step position.
|
||||
*
|
||||
* @return int The progress bar step
|
||||
*/
|
||||
public function getProgress()
|
||||
public function getProgress(): int
|
||||
{
|
||||
return $this->step;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the progress bar step width.
|
||||
*
|
||||
* @return int The progress bar step width
|
||||
*/
|
||||
private function getStepWidth()
|
||||
private function getStepWidth(): int
|
||||
{
|
||||
return $this->stepWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current progress bar percent.
|
||||
*
|
||||
* @return float The current progress bar percent
|
||||
*/
|
||||
public function getProgressPercent()
|
||||
public function getProgressPercent(): float
|
||||
{
|
||||
return $this->percent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the progress bar width.
|
||||
*
|
||||
* @param int $size The progress bar size
|
||||
*/
|
||||
public function setBarWidth($size)
|
||||
public function setBarWidth(int $size)
|
||||
{
|
||||
$this->barWidth = max(1, (int) $size);
|
||||
$this->barWidth = max(1, $size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the progress bar width.
|
||||
*
|
||||
* @return int The progress bar size
|
||||
*/
|
||||
public function getBarWidth()
|
||||
public function getBarWidth(): int
|
||||
{
|
||||
return $this->barWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bar character.
|
||||
*
|
||||
* @param string $char A character
|
||||
*/
|
||||
public function setBarCharacter($char)
|
||||
public function setBarCharacter(string $char)
|
||||
{
|
||||
$this->barChar = $char;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bar character.
|
||||
*
|
||||
* @return string A character
|
||||
*/
|
||||
public function getBarCharacter()
|
||||
public function getBarCharacter(): string
|
||||
{
|
||||
if (null === $this->barChar) {
|
||||
return $this->max ? '=' : $this->emptyBarChar;
|
||||
@@ -251,52 +207,27 @@ final class ProgressBar
|
||||
return $this->barChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the empty bar character.
|
||||
*
|
||||
* @param string $char A character
|
||||
*/
|
||||
public function setEmptyBarCharacter($char)
|
||||
public function setEmptyBarCharacter(string $char)
|
||||
{
|
||||
$this->emptyBarChar = $char;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the empty bar character.
|
||||
*
|
||||
* @return string A character
|
||||
*/
|
||||
public function getEmptyBarCharacter()
|
||||
public function getEmptyBarCharacter(): string
|
||||
{
|
||||
return $this->emptyBarChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the progress bar character.
|
||||
*
|
||||
* @param string $char A character
|
||||
*/
|
||||
public function setProgressCharacter($char)
|
||||
public function setProgressCharacter(string $char)
|
||||
{
|
||||
$this->progressChar = $char;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the progress bar character.
|
||||
*
|
||||
* @return string A character
|
||||
*/
|
||||
public function getProgressCharacter()
|
||||
public function getProgressCharacter(): string
|
||||
{
|
||||
return $this->progressChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the progress bar format.
|
||||
*
|
||||
* @param string $format The format
|
||||
*/
|
||||
public function setFormat($format)
|
||||
public function setFormat(string $format)
|
||||
{
|
||||
$this->format = null;
|
||||
$this->internalFormat = $format;
|
||||
@@ -307,9 +238,9 @@ final class ProgressBar
|
||||
*
|
||||
* @param int|float $freq The frequency in steps
|
||||
*/
|
||||
public function setRedrawFrequency($freq)
|
||||
public function setRedrawFrequency(int $freq)
|
||||
{
|
||||
$this->redrawFreq = max((int) $freq, 1);
|
||||
$this->redrawFreq = max($freq, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,7 +248,7 @@ final class ProgressBar
|
||||
*
|
||||
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged
|
||||
*/
|
||||
public function start($max = null)
|
||||
public function start(int $max = null)
|
||||
{
|
||||
$this->startTime = time();
|
||||
$this->step = 0;
|
||||
@@ -335,30 +266,21 @@ final class ProgressBar
|
||||
*
|
||||
* @param int $step Number of steps to advance
|
||||
*/
|
||||
public function advance($step = 1)
|
||||
public function advance(int $step = 1)
|
||||
{
|
||||
$this->setProgress($this->step + $step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to overwrite the progressbar, false for new line.
|
||||
*
|
||||
* @param bool $overwrite
|
||||
*/
|
||||
public function setOverwrite($overwrite)
|
||||
public function setOverwrite(bool $overwrite)
|
||||
{
|
||||
$this->overwrite = (bool) $overwrite;
|
||||
$this->overwrite = $overwrite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current progress.
|
||||
*
|
||||
* @param int $step The current progress
|
||||
*/
|
||||
public function setProgress($step)
|
||||
public function setProgress(int $step)
|
||||
{
|
||||
$step = (int) $step;
|
||||
|
||||
if ($this->max && $step > $this->max) {
|
||||
$this->max = $step;
|
||||
} elseif ($step < 0) {
|
||||
@@ -374,10 +296,17 @@ final class ProgressBar
|
||||
}
|
||||
}
|
||||
|
||||
public function setMaxSteps(int $max)
|
||||
{
|
||||
$this->format = null;
|
||||
$this->max = max(0, $max);
|
||||
$this->stepWidth = $this->max ? Helper::strlen((string) $this->max) : 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the progress output.
|
||||
*/
|
||||
public function finish()
|
||||
public function finish(): void
|
||||
{
|
||||
if (!$this->max) {
|
||||
$this->max = $this->step;
|
||||
@@ -394,7 +323,7 @@ final class ProgressBar
|
||||
/**
|
||||
* Outputs the current progress string.
|
||||
*/
|
||||
public function display()
|
||||
public function display(): void
|
||||
{
|
||||
if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
|
||||
return;
|
||||
@@ -414,7 +343,7 @@ final class ProgressBar
|
||||
* while a progress bar is running.
|
||||
* Call display() to show the progress bar again.
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): void
|
||||
{
|
||||
if (!$this->overwrite) {
|
||||
return;
|
||||
@@ -427,12 +356,7 @@ final class ProgressBar
|
||||
$this->overwrite('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the progress bar format.
|
||||
*
|
||||
* @param string $format The format
|
||||
*/
|
||||
private function setRealFormat($format)
|
||||
private function setRealFormat(string $format)
|
||||
{
|
||||
// try to use the _nomax variant if available
|
||||
if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
|
||||
@@ -446,35 +370,27 @@ final class ProgressBar
|
||||
$this->formatLineCount = substr_count($this->format, "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the progress bar maximal steps.
|
||||
*
|
||||
* @param int $max The progress bar max steps
|
||||
*/
|
||||
private function setMaxSteps($max)
|
||||
{
|
||||
$this->max = max(0, (int) $max);
|
||||
$this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites a previous message to the output.
|
||||
*
|
||||
* @param string $message The message
|
||||
*/
|
||||
private function overwrite($message)
|
||||
private function overwrite(string $message): void
|
||||
{
|
||||
if ($this->overwrite) {
|
||||
if (!$this->firstRun) {
|
||||
// Move the cursor to the beginning of the line
|
||||
$this->output->write("\x0D");
|
||||
if ($this->output instanceof ConsoleSectionOutput) {
|
||||
$lines = floor(Helper::strlen($message) / $this->terminal->getWidth()) + $this->formatLineCount + 1;
|
||||
$this->output->clear($lines);
|
||||
} else {
|
||||
// Move the cursor to the beginning of the line
|
||||
$this->output->write("\x0D");
|
||||
|
||||
// Erase the line
|
||||
$this->output->write("\x1B[2K");
|
||||
// Erase the line
|
||||
$this->output->write("\x1B[2K");
|
||||
|
||||
// Erase previous lines
|
||||
if ($this->formatLineCount > 0) {
|
||||
$this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
|
||||
// Erase previous lines
|
||||
if ($this->formatLineCount > 0) {
|
||||
$this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($this->step > 0) {
|
||||
@@ -486,7 +402,7 @@ final class ProgressBar
|
||||
$this->output->write($message);
|
||||
}
|
||||
|
||||
private function determineBestFormat()
|
||||
private function determineBestFormat(): string
|
||||
{
|
||||
switch ($this->output->getVerbosity()) {
|
||||
// OutputInterface::VERBOSITY_QUIET: display is disabled anyway
|
||||
@@ -501,7 +417,7 @@ final class ProgressBar
|
||||
}
|
||||
}
|
||||
|
||||
private static function initPlaceholderFormatters()
|
||||
private static function initPlaceholderFormatters(): array
|
||||
{
|
||||
return array(
|
||||
'bar' => function (ProgressBar $bar, OutputInterface $output) {
|
||||
@@ -558,7 +474,7 @@ final class ProgressBar
|
||||
);
|
||||
}
|
||||
|
||||
private static function initFormats()
|
||||
private static function initFormats(): array
|
||||
{
|
||||
return array(
|
||||
'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
|
||||
@@ -575,10 +491,7 @@ final class ProgressBar
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function buildLine()
|
||||
private function buildLine(): string
|
||||
{
|
||||
$regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
|
||||
$callback = function ($matches) {
|
||||
|
@@ -39,7 +39,7 @@ class ProgressIndicator
|
||||
* @param int $indicatorChangeInterval Change interval in milliseconds
|
||||
* @param array|null $indicatorValues Animated indicator characters
|
||||
*/
|
||||
public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
|
||||
public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
|
||||
{
|
||||
$this->output = $output;
|
||||
|
||||
@@ -219,10 +219,8 @@ class ProgressIndicator
|
||||
|
||||
/**
|
||||
* Overwrites a previous message to the output.
|
||||
*
|
||||
* @param string $message The message
|
||||
*/
|
||||
private function overwrite($message)
|
||||
private function overwrite(string $message)
|
||||
{
|
||||
if ($this->output->isDecorated()) {
|
||||
$this->output->write("\x0D\x1B[2K");
|
||||
|
54
vendor/symfony/console/Helper/QuestionHelper.php
vendored
54
vendor/symfony/console/Helper/QuestionHelper.php
vendored
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
@@ -71,46 +70,6 @@ class QuestionHelper extends Helper
|
||||
return $this->validateAttempts($interviewer, $output, $question);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the input stream to read from when interacting with the user.
|
||||
*
|
||||
* This is mainly useful for testing purpose.
|
||||
*
|
||||
* @deprecated since version 3.2, to be removed in 4.0. Use
|
||||
* StreamableInputInterface::setStream() instead.
|
||||
*
|
||||
* @param resource $stream The input stream
|
||||
*
|
||||
* @throws InvalidArgumentException In case the stream is not a resource
|
||||
*/
|
||||
public function setInputStream($stream)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED);
|
||||
|
||||
if (!\is_resource($stream)) {
|
||||
throw new InvalidArgumentException('Input stream must be a valid resource.');
|
||||
}
|
||||
|
||||
$this->inputStream = $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the helper's input stream.
|
||||
*
|
||||
* @deprecated since version 3.2, to be removed in 4.0. Use
|
||||
* StreamableInputInterface::getStream() instead.
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public function getInputStream()
|
||||
{
|
||||
if (0 === \func_num_args() || func_get_arg(0)) {
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
return $this->inputStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -217,11 +176,8 @@ class QuestionHelper extends Helper
|
||||
* @param OutputInterface $output
|
||||
* @param Question $question
|
||||
* @param resource $inputStream
|
||||
* @param array $autocomplete
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
|
||||
private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete): string
|
||||
{
|
||||
$ret = '';
|
||||
|
||||
@@ -336,11 +292,9 @@ class QuestionHelper extends Helper
|
||||
* @param OutputInterface $output An Output instance
|
||||
* @param resource $inputStream The handler resource
|
||||
*
|
||||
* @return string The answer
|
||||
*
|
||||
* @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
|
||||
*/
|
||||
private function getHiddenResponse(OutputInterface $output, $inputStream)
|
||||
private function getHiddenResponse(OutputInterface $output, $inputStream): string
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
|
||||
@@ -451,10 +405,8 @@ class QuestionHelper extends Helper
|
||||
|
||||
/**
|
||||
* Returns whether Stty is available or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function hasSttyAvailable()
|
||||
private function hasSttyAvailable(): bool
|
||||
{
|
||||
if (null !== self::$stty) {
|
||||
return self::$stty;
|
||||
|
@@ -11,9 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
@@ -27,32 +25,6 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
*/
|
||||
class SymfonyQuestionHelper extends QuestionHelper
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* To be removed in 4.0
|
||||
*/
|
||||
public function ask(InputInterface $input, OutputInterface $output, Question $question)
|
||||
{
|
||||
$validator = $question->getValidator();
|
||||
$question->setValidator(function ($value) use ($validator) {
|
||||
if (null !== $validator) {
|
||||
$value = $validator($value);
|
||||
} else {
|
||||
// make required
|
||||
if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
|
||||
@trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', E_USER_DEPRECATED);
|
||||
|
||||
throw new LogicException('A value is required.');
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
});
|
||||
|
||||
return parent::ask($input, $output, $question);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
240
vendor/symfony/console/Helper/Table.php
vendored
240
vendor/symfony/console/Helper/Table.php
vendored
@@ -12,6 +12,8 @@
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Output\ConsoleSectionOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
@@ -21,9 +23,17 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
* @author Саша Стаменковић <umpirsky@gmail.com>
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
* @author Max Grigorian <maxakawizard@gmail.com>
|
||||
* @author Dany Maillard <danymaillard93b@gmail.com>
|
||||
*/
|
||||
class Table
|
||||
{
|
||||
private const SEPARATOR_TOP = 0;
|
||||
private const SEPARATOR_TOP_BOTTOM = 1;
|
||||
private const SEPARATOR_MID = 2;
|
||||
private const SEPARATOR_BOTTOM = 3;
|
||||
private const BORDER_OUTSIDE = 0;
|
||||
private const BORDER_INSIDE = 1;
|
||||
|
||||
/**
|
||||
* Table headers.
|
||||
*/
|
||||
@@ -70,6 +80,8 @@ class Table
|
||||
|
||||
private static $styles;
|
||||
|
||||
private $rendered = false;
|
||||
|
||||
public function __construct(OutputInterface $output)
|
||||
{
|
||||
$this->output = $output;
|
||||
@@ -252,6 +264,25 @@ class Table
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a row to the table, and re-renders the table.
|
||||
*/
|
||||
public function appendRow($row): self
|
||||
{
|
||||
if (!$this->output instanceof ConsoleSectionOutput) {
|
||||
throw new RuntimeException(sprintf('Output should be an instance of "%s" when calling "%s".', ConsoleSectionOutput::class, __METHOD__));
|
||||
}
|
||||
|
||||
if ($this->rendered) {
|
||||
$this->output->clear($this->calculateRowCount());
|
||||
}
|
||||
|
||||
$this->addRow($row);
|
||||
$this->render();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setRow($column, array $row)
|
||||
{
|
||||
$this->rows[$column] = $row;
|
||||
@@ -275,31 +306,43 @@ class Table
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->calculateNumberOfColumns();
|
||||
$rows = $this->buildTableRows($this->rows);
|
||||
$headers = $this->buildTableRows($this->headers);
|
||||
$rows = array_merge($this->headers, array($divider = new TableSeparator()), $this->rows);
|
||||
$this->calculateNumberOfColumns($rows);
|
||||
|
||||
$this->calculateColumnsWidth(array_merge($headers, $rows));
|
||||
$rows = $this->buildTableRows($rows);
|
||||
$this->calculateColumnsWidth($rows);
|
||||
|
||||
$this->renderRowSeparator();
|
||||
if (!empty($headers)) {
|
||||
foreach ($headers as $header) {
|
||||
$this->renderRow($header, $this->style->getCellHeaderFormat());
|
||||
$this->renderRowSeparator();
|
||||
}
|
||||
}
|
||||
$isHeader = true;
|
||||
$isFirstRow = false;
|
||||
foreach ($rows as $row) {
|
||||
if ($divider === $row) {
|
||||
$isHeader = false;
|
||||
$isFirstRow = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
if ($row instanceof TableSeparator) {
|
||||
$this->renderRowSeparator();
|
||||
} else {
|
||||
$this->renderRow($row, $this->style->getCellRowFormat());
|
||||
|
||||
continue;
|
||||
}
|
||||
if (!$row) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($isHeader || $isFirstRow) {
|
||||
$this->renderRowSeparator($isFirstRow ? self::SEPARATOR_TOP_BOTTOM : self::SEPARATOR_TOP);
|
||||
if ($isFirstRow) {
|
||||
$isFirstRow = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
|
||||
}
|
||||
if (!empty($rows)) {
|
||||
$this->renderRowSeparator();
|
||||
}
|
||||
$this->renderRowSeparator(self::SEPARATOR_BOTTOM);
|
||||
|
||||
$this->cleanup();
|
||||
$this->rendered = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,19 +350,32 @@ class Table
|
||||
*
|
||||
* Example: <code>+-----+-----------+-------+</code>
|
||||
*/
|
||||
private function renderRowSeparator()
|
||||
private function renderRowSeparator(int $type = self::SEPARATOR_MID)
|
||||
{
|
||||
if (0 === $count = $this->numberOfColumns) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
|
||||
$borders = $this->style->getBorderChars();
|
||||
if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$markup = $this->style->getCrossingChar();
|
||||
$crossings = $this->style->getCrossingChars();
|
||||
if (self::SEPARATOR_MID === $type) {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = array($borders[2], $crossings[8], $crossings[0], $crossings[4]);
|
||||
} elseif (self::SEPARATOR_TOP === $type) {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = array($borders[0], $crossings[1], $crossings[2], $crossings[3]);
|
||||
} elseif (self::SEPARATOR_TOP_BOTTOM === $type) {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = array($borders[0], $crossings[9], $crossings[10], $crossings[11]);
|
||||
} else {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = array($borders[0], $crossings[7], $crossings[6], $crossings[5]);
|
||||
}
|
||||
|
||||
$markup = $leftChar;
|
||||
for ($column = 0; $column < $count; ++$column) {
|
||||
$markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->effectiveColumnWidths[$column]).$this->style->getCrossingChar();
|
||||
$markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]);
|
||||
$markup .= $column === $count - 1 ? $rightChar : $midChar;
|
||||
}
|
||||
|
||||
$this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
|
||||
@@ -328,41 +384,34 @@ class Table
|
||||
/**
|
||||
* Renders vertical column separator.
|
||||
*/
|
||||
private function renderColumnSeparator()
|
||||
private function renderColumnSeparator($type = self::BORDER_OUTSIDE)
|
||||
{
|
||||
return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
|
||||
$borders = $this->style->getBorderChars();
|
||||
|
||||
return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders table row.
|
||||
*
|
||||
* Example: <code>| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |</code>
|
||||
*
|
||||
* @param array $row
|
||||
* @param string $cellFormat
|
||||
*/
|
||||
private function renderRow(array $row, $cellFormat)
|
||||
private function renderRow(array $row, string $cellFormat)
|
||||
{
|
||||
if (empty($row)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rowContent = $this->renderColumnSeparator();
|
||||
foreach ($this->getRowColumns($row) as $column) {
|
||||
$rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
|
||||
$columns = $this->getRowColumns($row);
|
||||
$last = \count($columns) - 1;
|
||||
foreach ($columns as $i => $column) {
|
||||
$rowContent .= $this->renderCell($row, $column, $cellFormat);
|
||||
$rowContent .= $this->renderColumnSeparator();
|
||||
$rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
|
||||
}
|
||||
$this->output->writeln($rowContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders table cell with padding.
|
||||
*
|
||||
* @param array $row
|
||||
* @param int $column
|
||||
* @param string $cellFormat
|
||||
*/
|
||||
private function renderCell(array $row, $column, $cellFormat)
|
||||
private function renderCell(array $row, int $column, string $cellFormat)
|
||||
{
|
||||
$cell = isset($row[$column]) ? $row[$column] : '';
|
||||
$width = $this->effectiveColumnWidths[$column];
|
||||
@@ -381,7 +430,7 @@ class Table
|
||||
$style = $this->getColumnStyle($column);
|
||||
|
||||
if ($cell instanceof TableSeparator) {
|
||||
return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
|
||||
return sprintf($style->getBorderFormat(), str_repeat($style->getBorderChars()[2], $width));
|
||||
}
|
||||
|
||||
$width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
||||
@@ -393,14 +442,10 @@ class Table
|
||||
/**
|
||||
* Calculate number of columns for this table.
|
||||
*/
|
||||
private function calculateNumberOfColumns()
|
||||
private function calculateNumberOfColumns($rows)
|
||||
{
|
||||
if (null !== $this->numberOfColumns) {
|
||||
return;
|
||||
}
|
||||
|
||||
$columns = array(0);
|
||||
foreach (array_merge($this->headers, $this->rows) as $row) {
|
||||
foreach ($rows as $row) {
|
||||
if ($row instanceof TableSeparator) {
|
||||
continue;
|
||||
}
|
||||
@@ -436,28 +481,38 @@ class Table
|
||||
}
|
||||
}
|
||||
|
||||
$tableRows = array();
|
||||
foreach ($rows as $rowKey => $row) {
|
||||
$tableRows[] = $this->fillCells($row);
|
||||
if (isset($unmergedRows[$rowKey])) {
|
||||
$tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
|
||||
return new TableRows(function () use ($rows, $unmergedRows) {
|
||||
foreach ($rows as $rowKey => $row) {
|
||||
yield $this->fillCells($row);
|
||||
|
||||
if (isset($unmergedRows[$rowKey])) {
|
||||
foreach ($unmergedRows[$rowKey] as $row) {
|
||||
yield $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private function calculateRowCount(): int
|
||||
{
|
||||
$numberOfRows = \count(iterator_to_array($this->buildTableRows(array_merge($this->headers, array(new TableSeparator()), $this->rows))));
|
||||
|
||||
if ($this->headers) {
|
||||
++$numberOfRows; // Add row for header separator
|
||||
}
|
||||
|
||||
return $tableRows;
|
||||
++$numberOfRows; // Add row for footer separator
|
||||
|
||||
return $numberOfRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* fill rows that contains rowspan > 1.
|
||||
*
|
||||
* @param array $rows
|
||||
* @param int $line
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function fillNextRows(array $rows, $line)
|
||||
private function fillNextRows(array $rows, int $line): array
|
||||
{
|
||||
$unmergedRows = array();
|
||||
foreach ($rows[$line] as $column => $cell) {
|
||||
@@ -510,8 +565,6 @@ class Table
|
||||
|
||||
/**
|
||||
* fill cells for a row that contains colspan > 1.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function fillCells($row)
|
||||
{
|
||||
@@ -529,13 +582,7 @@ class Table
|
||||
return $newRow ?: $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $rows
|
||||
* @param int $line
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function copyRow(array $rows, $line)
|
||||
private function copyRow(array $rows, int $line): array
|
||||
{
|
||||
$row = $rows[$line];
|
||||
foreach ($row as $cellKey => $cellValue) {
|
||||
@@ -550,10 +597,8 @@ class Table
|
||||
|
||||
/**
|
||||
* Gets number of columns by row.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function getNumberOfColumns(array $row)
|
||||
private function getNumberOfColumns(array $row): int
|
||||
{
|
||||
$columns = \count($row);
|
||||
foreach ($row as $column) {
|
||||
@@ -565,10 +610,8 @@ class Table
|
||||
|
||||
/**
|
||||
* Gets list of columns for the given row.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getRowColumns(array $row)
|
||||
private function getRowColumns(array $row): array
|
||||
{
|
||||
$columns = range(0, $this->numberOfColumns - 1);
|
||||
foreach ($row as $cellKey => $cell) {
|
||||
@@ -584,7 +627,7 @@ class Table
|
||||
/**
|
||||
* Calculates columns widths.
|
||||
*/
|
||||
private function calculateColumnsWidth(array $rows)
|
||||
private function calculateColumnsWidth(iterable $rows)
|
||||
{
|
||||
for ($column = 0; $column < $this->numberOfColumns; ++$column) {
|
||||
$lengths = array();
|
||||
@@ -613,25 +656,12 @@ class Table
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets column width.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function getColumnSeparatorWidth()
|
||||
private function getColumnSeparatorWidth(): int
|
||||
{
|
||||
return \strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
|
||||
return \strlen(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets cell width.
|
||||
*
|
||||
* @param array $row
|
||||
* @param int $column
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function getCellWidth(array $row, $column)
|
||||
private function getCellWidth(array $row, int $column): int
|
||||
{
|
||||
$cellWidth = 0;
|
||||
|
||||
@@ -658,32 +688,46 @@ class Table
|
||||
{
|
||||
$borderless = new TableStyle();
|
||||
$borderless
|
||||
->setHorizontalBorderChar('=')
|
||||
->setVerticalBorderChar(' ')
|
||||
->setCrossingChar(' ')
|
||||
->setHorizontalBorderChars('=')
|
||||
->setVerticalBorderChars(' ')
|
||||
->setDefaultCrossingChar(' ')
|
||||
;
|
||||
|
||||
$compact = new TableStyle();
|
||||
$compact
|
||||
->setHorizontalBorderChar('')
|
||||
->setVerticalBorderChar(' ')
|
||||
->setCrossingChar('')
|
||||
->setHorizontalBorderChars('')
|
||||
->setVerticalBorderChars(' ')
|
||||
->setDefaultCrossingChar('')
|
||||
->setCellRowContentFormat('%s')
|
||||
;
|
||||
|
||||
$styleGuide = new TableStyle();
|
||||
$styleGuide
|
||||
->setHorizontalBorderChar('-')
|
||||
->setVerticalBorderChar(' ')
|
||||
->setCrossingChar(' ')
|
||||
->setHorizontalBorderChars('-')
|
||||
->setVerticalBorderChars(' ')
|
||||
->setDefaultCrossingChar(' ')
|
||||
->setCellHeaderFormat('%s')
|
||||
;
|
||||
|
||||
$box = (new TableStyle())
|
||||
->setHorizontalBorderChars('─')
|
||||
->setVerticalBorderChars('│')
|
||||
->setCrossingChars('┼', '┌', '┬', '┐', '┤', '┘', '┴', '└', '├')
|
||||
;
|
||||
|
||||
$boxDouble = (new TableStyle())
|
||||
->setHorizontalBorderChars('═', '─')
|
||||
->setVerticalBorderChars('║', '│')
|
||||
->setCrossingChars('┼', '╔', '╤', '╗', '╢', '╝', '╧', '╚', '╟', '╠', '╪', '╣')
|
||||
;
|
||||
|
||||
return array(
|
||||
'default' => new TableStyle(),
|
||||
'borderless' => $borderless,
|
||||
'compact' => $compact,
|
||||
'symfony-style-guide' => $styleGuide,
|
||||
'box' => $box,
|
||||
'box-double' => $boxDouble,
|
||||
);
|
||||
}
|
||||
|
||||
|
10
vendor/symfony/console/Helper/TableCell.php
vendored
10
vendor/symfony/console/Helper/TableCell.php
vendored
@@ -24,16 +24,8 @@ class TableCell
|
||||
'colspan' => 1,
|
||||
);
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct($value = '', array $options = array())
|
||||
public function __construct(string $value = '', array $options = array())
|
||||
{
|
||||
if (is_numeric($value) && !\is_string($value)) {
|
||||
$value = (string) $value;
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
|
||||
// check option names
|
||||
|
32
vendor/symfony/console/Helper/TableRows.php
vendored
Normal file
32
vendor/symfony/console/Helper/TableRows.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class TableRows implements \IteratorAggregate
|
||||
{
|
||||
private $generator;
|
||||
|
||||
public function __construct(callable $generator)
|
||||
{
|
||||
$this->generator = $generator;
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
$g = $this->generator;
|
||||
|
||||
return $g();
|
||||
}
|
||||
}
|
194
vendor/symfony/console/Helper/TableStyle.php
vendored
194
vendor/symfony/console/Helper/TableStyle.php
vendored
@@ -19,13 +19,27 @@ use Symfony\Component\Console\Exception\LogicException;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Саша Стаменковић <umpirsky@gmail.com>
|
||||
* @author Dany Maillard <danymaillard93b@gmail.com>
|
||||
*/
|
||||
class TableStyle
|
||||
{
|
||||
private $paddingChar = ' ';
|
||||
private $horizontalBorderChar = '-';
|
||||
private $verticalBorderChar = '|';
|
||||
private $horizontalOutsideBorderChar = '-';
|
||||
private $horizontalInsideBorderChar = '-';
|
||||
private $verticalOutsideBorderChar = '|';
|
||||
private $verticalInsideBorderChar = '|';
|
||||
private $crossingChar = '+';
|
||||
private $crossingTopRightChar = '+';
|
||||
private $crossingTopMidChar = '+';
|
||||
private $crossingTopLeftChar = '+';
|
||||
private $crossingMidRightChar = '+';
|
||||
private $crossingBottomRightChar = '+';
|
||||
private $crossingBottomMidChar = '+';
|
||||
private $crossingBottomLeftChar = '+';
|
||||
private $crossingMidLeftChar = '+';
|
||||
private $crossingTopLeftBottomChar = '+';
|
||||
private $crossingTopMidBottomChar = '+';
|
||||
private $crossingTopRightBottomChar = '+';
|
||||
private $cellHeaderFormat = '<info>%s</info>';
|
||||
private $cellRowFormat = '%s';
|
||||
private $cellRowContentFormat = ' %s ';
|
||||
@@ -60,28 +74,85 @@ class TableStyle
|
||||
return $this->paddingChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets horizontal border characters.
|
||||
*
|
||||
* <code>
|
||||
* ╔═══════════════╤══════════════════════════╤══════════════════╗
|
||||
* 1 ISBN 2 Title │ Author ║
|
||||
* ╠═══════════════╪══════════════════════════╪══════════════════╣
|
||||
* ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
|
||||
* ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
|
||||
* ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
|
||||
* ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
|
||||
* ╚═══════════════╧══════════════════════════╧══════════════════╝
|
||||
* </code>
|
||||
*
|
||||
* @param string $outside Outside border char (see #1 of example)
|
||||
* @param string|null $inside Inside border char (see #2 of example), equals $outside if null
|
||||
*/
|
||||
public function setHorizontalBorderChars(string $outside, string $inside = null): self
|
||||
{
|
||||
$this->horizontalOutsideBorderChar = $outside;
|
||||
$this->horizontalInsideBorderChar = $inside ?? $outside;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets horizontal border character.
|
||||
*
|
||||
* @param string $horizontalBorderChar
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since Symfony 4.1, use {@link setHorizontalBorderChars()} instead.
|
||||
*/
|
||||
public function setHorizontalBorderChar($horizontalBorderChar)
|
||||
{
|
||||
$this->horizontalBorderChar = $horizontalBorderChar;
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this;
|
||||
return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets horizontal border character.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @deprecated since Symfony 4.1, use {@link getBorderChars()} instead.
|
||||
*/
|
||||
public function getHorizontalBorderChar()
|
||||
{
|
||||
return $this->horizontalBorderChar;
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->horizontalOutsideBorderChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets vertical border characters.
|
||||
*
|
||||
* <code>
|
||||
* ╔═══════════════╤══════════════════════════╤══════════════════╗
|
||||
* ║ ISBN │ Title │ Author ║
|
||||
* ╠═══════1═══════╪══════════════════════════╪══════════════════╣
|
||||
* ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
|
||||
* ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
|
||||
* ╟───────2───────┼──────────────────────────┼──────────────────╢
|
||||
* ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
|
||||
* ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
|
||||
* ╚═══════════════╧══════════════════════════╧══════════════════╝
|
||||
* </code>
|
||||
*
|
||||
* @param string $outside Outside border char (see #1 of example)
|
||||
* @param string|null $inside Inside border char (see #2 of example), equals $outside if null
|
||||
*/
|
||||
public function setVerticalBorderChars(string $outside, string $inside = null): self
|
||||
{
|
||||
$this->verticalOutsideBorderChar = $outside;
|
||||
$this->verticalInsideBorderChar = $inside ?? $outside;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,22 +161,100 @@ class TableStyle
|
||||
* @param string $verticalBorderChar
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since Symfony 4.1, use {@link setVerticalBorderChars()} instead.
|
||||
*/
|
||||
public function setVerticalBorderChar($verticalBorderChar)
|
||||
{
|
||||
$this->verticalBorderChar = $verticalBorderChar;
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this;
|
||||
return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets vertical border character.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @deprecated since Symfony 4.1, use {@link getBorderChars()} instead.
|
||||
*/
|
||||
public function getVerticalBorderChar()
|
||||
{
|
||||
return $this->verticalBorderChar;
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->verticalOutsideBorderChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets border characters.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function getBorderChars()
|
||||
{
|
||||
return array(
|
||||
$this->horizontalOutsideBorderChar,
|
||||
$this->verticalOutsideBorderChar,
|
||||
$this->horizontalInsideBorderChar,
|
||||
$this->verticalInsideBorderChar,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets crossing characters.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* 1═══════════════2══════════════════════════2══════════════════3
|
||||
* ║ ISBN │ Title │ Author ║
|
||||
* 8'══════════════0'═════════════════════════0'═════════════════4'
|
||||
* ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
|
||||
* ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
|
||||
* 8───────────────0──────────────────────────0──────────────────4
|
||||
* ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
|
||||
* ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
|
||||
* 7═══════════════6══════════════════════════6══════════════════5
|
||||
* </code>
|
||||
*
|
||||
* @param string $cross Crossing char (see #0 of example)
|
||||
* @param string $topLeft Top left char (see #1 of example)
|
||||
* @param string $topMid Top mid char (see #2 of example)
|
||||
* @param string $topRight Top right char (see #3 of example)
|
||||
* @param string $midRight Mid right char (see #4 of example)
|
||||
* @param string $bottomRight Bottom right char (see #5 of example)
|
||||
* @param string $bottomMid Bottom mid char (see #6 of example)
|
||||
* @param string $bottomLeft Bottom left char (see #7 of example)
|
||||
* @param string $midLeft Mid left char (see #8 of example)
|
||||
* @param string|null $topLeftBottom Top left bottom char (see #8' of example), equals to $midLeft if null
|
||||
* @param string|null $topMidBottom Top mid bottom char (see #0' of example), equals to $cross if null
|
||||
* @param string|null $topRightBottom Top right bottom char (see #4' of example), equals to $midRight if null
|
||||
*/
|
||||
public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
|
||||
{
|
||||
$this->crossingChar = $cross;
|
||||
$this->crossingTopLeftChar = $topLeft;
|
||||
$this->crossingTopMidChar = $topMid;
|
||||
$this->crossingTopRightChar = $topRight;
|
||||
$this->crossingMidRightChar = $midRight;
|
||||
$this->crossingBottomRightChar = $bottomRight;
|
||||
$this->crossingBottomMidChar = $bottomMid;
|
||||
$this->crossingBottomLeftChar = $bottomLeft;
|
||||
$this->crossingMidLeftChar = $midLeft;
|
||||
$this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
|
||||
$this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
|
||||
$this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets default crossing character used for each cross.
|
||||
*
|
||||
* @see {@link setCrossingChars()} for setting each crossing individually.
|
||||
*/
|
||||
public function setDefaultCrossingChar(string $char): self
|
||||
{
|
||||
return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,12 +263,14 @@ class TableStyle
|
||||
* @param string $crossingChar
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since Symfony 4.1. Use {@link setDefaultCrossingChar()} instead.
|
||||
*/
|
||||
public function setCrossingChar($crossingChar)
|
||||
{
|
||||
$this->crossingChar = $crossingChar;
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this;
|
||||
return $this->setDefaultCrossingChar($crossingChar);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,6 +283,29 @@ class TableStyle
|
||||
return $this->crossingChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets crossing characters.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function getCrossingChars(): array
|
||||
{
|
||||
return array(
|
||||
$this->crossingChar,
|
||||
$this->crossingTopLeftChar,
|
||||
$this->crossingTopMidChar,
|
||||
$this->crossingTopRightChar,
|
||||
$this->crossingMidRightChar,
|
||||
$this->crossingBottomRightChar,
|
||||
$this->crossingBottomMidChar,
|
||||
$this->crossingBottomLeftChar,
|
||||
$this->crossingMidLeftChar,
|
||||
$this->crossingTopLeftBottomChar,
|
||||
$this->crossingTopMidBottomChar,
|
||||
$this->crossingTopRightBottomChar,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets header cell format.
|
||||
*
|
||||
|
Reference in New Issue
Block a user