update 1.0.8.0
Commits for version update
This commit is contained in:
19
vendor/symfony/console/Application.php
vendored
19
vendor/symfony/console/Application.php
vendored
@@ -210,7 +210,7 @@ class Application
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an input definition set to be used with this application.
|
||||
* Set an input definition to be used with this application.
|
||||
*
|
||||
* @param InputDefinition $definition The input definition
|
||||
*/
|
||||
@@ -232,7 +232,7 @@ class Application
|
||||
/**
|
||||
* Gets the help message.
|
||||
*
|
||||
* @return string A help message.
|
||||
* @return string A help message
|
||||
*/
|
||||
public function getHelp()
|
||||
{
|
||||
@@ -332,6 +332,8 @@ class Application
|
||||
/**
|
||||
* Adds an array of command objects.
|
||||
*
|
||||
* If a Command is not enabled it will not be added.
|
||||
*
|
||||
* @param Command[] $commands An array of commands
|
||||
*/
|
||||
public function addCommands(array $commands)
|
||||
@@ -345,10 +347,11 @@ class Application
|
||||
* Adds a command object.
|
||||
*
|
||||
* If a command with the same name already exists, it will be overridden.
|
||||
* If the command is not enabled it will not be added.
|
||||
*
|
||||
* @param Command $command A Command object
|
||||
*
|
||||
* @return Command The registered command
|
||||
* @return Command|null The registered command if enabled or null
|
||||
*/
|
||||
public function add(Command $command)
|
||||
{
|
||||
@@ -417,9 +420,9 @@ class Application
|
||||
/**
|
||||
* Returns an array of all unique namespaces used by currently registered commands.
|
||||
*
|
||||
* It does not returns the global namespace which always exists.
|
||||
* It does not return the global namespace which always exists.
|
||||
*
|
||||
* @return array An array of namespaces
|
||||
* @return string[] An array of namespaces
|
||||
*/
|
||||
public function getNamespaces()
|
||||
{
|
||||
@@ -909,7 +912,7 @@ class Application
|
||||
/**
|
||||
* Runs and parses mode CON if it's available, suppressing any error output.
|
||||
*
|
||||
* @return string <width>x<height> or null if it could not be parsed
|
||||
* @return string|null <width>x<height> or null if it could not be parsed
|
||||
*/
|
||||
private function getConsoleMode()
|
||||
{
|
||||
@@ -968,7 +971,7 @@ class Application
|
||||
* @param string $name The string
|
||||
* @param array|\Traversable $collection The collection
|
||||
*
|
||||
* @return array A sorted array of similar string
|
||||
* @return string[] A sorted array of similar string
|
||||
*/
|
||||
private function findAlternatives($name, $collection)
|
||||
{
|
||||
@@ -1067,7 +1070,7 @@ class Application
|
||||
*
|
||||
* @param string $name The full name of the command
|
||||
*
|
||||
* @return array The namespaces of the command
|
||||
* @return string[] The namespaces of the command
|
||||
*/
|
||||
private function extractAllNamespaces($name)
|
||||
{
|
||||
|
@@ -21,10 +21,10 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
|
||||
private $alternatives;
|
||||
|
||||
/**
|
||||
* @param string $message Exception message to throw.
|
||||
* @param array $alternatives List of similar defined names.
|
||||
* @param int $code Exception code.
|
||||
* @param Exception $previous previous exception used for the exception chaining.
|
||||
* @param string $message Exception message to throw
|
||||
* @param array $alternatives List of similar defined names
|
||||
* @param int $code Exception code
|
||||
* @param Exception $previous previous exception used for the exception chaining
|
||||
*/
|
||||
public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array A list of similar defined names.
|
||||
* @return array A list of similar defined names
|
||||
*/
|
||||
public function getAlternatives()
|
||||
{
|
||||
|
8
vendor/symfony/console/Helper/HelperSet.php
vendored
8
vendor/symfony/console/Helper/HelperSet.php
vendored
@@ -21,13 +21,16 @@ use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
*/
|
||||
class HelperSet implements \IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* @var Helper[]
|
||||
*/
|
||||
private $helpers = array();
|
||||
private $command;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Helper[] $helpers An array of helper.
|
||||
* @param Helper[] $helpers An array of helper
|
||||
*/
|
||||
public function __construct(array $helpers = array())
|
||||
{
|
||||
@@ -102,6 +105,9 @@ class HelperSet implements \IteratorAggregate
|
||||
return $this->command;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Helper[]
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->helpers);
|
||||
|
31
vendor/symfony/console/Helper/ProgressBar.php
vendored
31
vendor/symfony/console/Helper/ProgressBar.php
vendored
@@ -42,8 +42,9 @@ class ProgressBar
|
||||
private $stepWidth;
|
||||
private $percent = 0.0;
|
||||
private $formatLineCount;
|
||||
private $messages;
|
||||
private $messages = array();
|
||||
private $overwrite = true;
|
||||
private $firstRun = true;
|
||||
|
||||
private static $formatters;
|
||||
private static $formats;
|
||||
@@ -140,6 +141,16 @@ class ProgressBar
|
||||
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associates a text with a named placeholder.
|
||||
*
|
||||
* The text is displayed when the progress bar is rendered but only
|
||||
* when the corresponding placeholder is part of the custom format line
|
||||
* (by wrapping the name with %).
|
||||
*
|
||||
* @param string $message The text to associate with the placeholder
|
||||
* @param string $name The name of the placeholder
|
||||
*/
|
||||
public function setMessage($message, $name = 'message')
|
||||
{
|
||||
$this->messages[$name] = $message;
|
||||
@@ -477,20 +488,24 @@ class ProgressBar
|
||||
private function overwrite($message)
|
||||
{
|
||||
if ($this->overwrite) {
|
||||
// Move the cursor to the beginning of the line
|
||||
$this->output->write("\x0D");
|
||||
if (!$this->firstRun) {
|
||||
// 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) {
|
||||
$this->output->writeln('');
|
||||
}
|
||||
|
||||
$this->firstRun = false;
|
||||
|
||||
$this->output->write($message);
|
||||
}
|
||||
|
||||
|
@@ -67,6 +67,18 @@ class SymfonyQuestionHelper extends QuestionHelper
|
||||
|
||||
break;
|
||||
|
||||
case $question instanceof ChoiceQuestion && $question->isMultiselect():
|
||||
$choices = $question->getChoices();
|
||||
$default = explode(',', $default);
|
||||
|
||||
foreach ($default as $key => $value) {
|
||||
$default[$key] = $choices[trim($value)];
|
||||
}
|
||||
|
||||
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, implode(', ', $default));
|
||||
|
||||
break;
|
||||
|
||||
case $question instanceof ChoiceQuestion:
|
||||
$choices = $question->getChoices();
|
||||
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $choices[$default]);
|
||||
|
37
vendor/symfony/console/Helper/Table.php
vendored
37
vendor/symfony/console/Helper/Table.php
vendored
@@ -108,11 +108,11 @@ class Table
|
||||
self::$styles = self::initStyles();
|
||||
}
|
||||
|
||||
if (!self::$styles[$name]) {
|
||||
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
|
||||
if (isset(self::$styles[$name])) {
|
||||
return self::$styles[$name];
|
||||
}
|
||||
|
||||
return self::$styles[$name];
|
||||
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,13 +124,7 @@ class Table
|
||||
*/
|
||||
public function setStyle($name)
|
||||
{
|
||||
if ($name instanceof TableStyle) {
|
||||
$this->style = $name;
|
||||
} elseif (isset(self::$styles[$name])) {
|
||||
$this->style = self::$styles[$name];
|
||||
} else {
|
||||
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
|
||||
}
|
||||
$this->style = $this->resolveStyle($name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -157,13 +151,7 @@ class Table
|
||||
{
|
||||
$columnIndex = intval($columnIndex);
|
||||
|
||||
if ($name instanceof TableStyle) {
|
||||
$this->columnStyles[$columnIndex] = $name;
|
||||
} elseif (isset(self::$styles[$name])) {
|
||||
$this->columnStyles[$columnIndex] = self::$styles[$name];
|
||||
} else {
|
||||
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
|
||||
}
|
||||
$this->columnStyles[$columnIndex] = $this->resolveStyle($name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -448,7 +436,7 @@ class Table
|
||||
}
|
||||
|
||||
// create a two dimensional array (rowspan x colspan)
|
||||
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, ''), $unmergedRows);
|
||||
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
|
||||
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
|
||||
$value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
|
||||
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
|
||||
@@ -660,4 +648,17 @@ class Table
|
||||
'symfony-style-guide' => $styleGuide,
|
||||
);
|
||||
}
|
||||
|
||||
private function resolveStyle($name)
|
||||
{
|
||||
if ($name instanceof TableStyle) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
if (isset(self::$styles[$name])) {
|
||||
return self::$styles[$name];
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
|
||||
}
|
||||
}
|
||||
|
@@ -19,8 +19,7 @@ namespace Symfony\Component\Console\Helper;
|
||||
class TableSeparator extends TableCell
|
||||
{
|
||||
/**
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $options = array())
|
||||
{
|
||||
|
40
vendor/symfony/console/Input/ArgvInput.php
vendored
40
vendor/symfony/console/Input/ArgvInput.php
vendored
@@ -46,8 +46,8 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $argv An array of parameters from the CLI (in the argv format)
|
||||
* @param InputDefinition $definition A InputDefinition instance
|
||||
* @param array|null $argv An array of parameters from the CLI (in the argv format)
|
||||
* @param InputDefinition|null $definition A InputDefinition instance
|
||||
*/
|
||||
public function __construct(array $argv = null, InputDefinition $definition = null)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ class ArgvInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes command line arguments.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function parse()
|
||||
{
|
||||
@@ -93,7 +93,7 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Parses a short option.
|
||||
*
|
||||
* @param string $token The current token.
|
||||
* @param string $token The current token
|
||||
*/
|
||||
private function parseShortOption($token)
|
||||
{
|
||||
@@ -176,7 +176,12 @@ class ArgvInput extends Input
|
||||
|
||||
// unexpected argument
|
||||
} else {
|
||||
throw new RuntimeException('Too many arguments.');
|
||||
$all = $this->definition->getArguments();
|
||||
if (count($all)) {
|
||||
throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,9 +258,7 @@ class ArgvInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first argument from the raw parameters (not parsed).
|
||||
*
|
||||
* @return string The value of the first argument or null otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFirstArgument()
|
||||
{
|
||||
@@ -269,15 +272,7 @@ class ArgvInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the raw parameters (not parsed) contain a value.
|
||||
*
|
||||
* This method is to be used to introspect the input parameters
|
||||
* before they have been validated. It must be used carefully.
|
||||
*
|
||||
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
|
||||
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
||||
*
|
||||
* @return bool true if the value is contained in the raw parameters
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasParameterOption($values, $onlyParams = false)
|
||||
{
|
||||
@@ -298,16 +293,7 @@ class ArgvInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a raw option (not parsed).
|
||||
*
|
||||
* This method is to be used to introspect the input parameters
|
||||
* before they have been validated. It must be used carefully.
|
||||
*
|
||||
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
|
||||
* @param mixed $default The default value to return if no result is found
|
||||
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
||||
*
|
||||
* @return mixed The option value
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParameterOption($values, $default = false, $onlyParams = false)
|
||||
{
|
||||
|
31
vendor/symfony/console/Input/ArrayInput.php
vendored
31
vendor/symfony/console/Input/ArrayInput.php
vendored
@@ -30,8 +30,8 @@ class ArrayInput extends Input
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $parameters An array of parameters
|
||||
* @param InputDefinition $definition A InputDefinition instance
|
||||
* @param array $parameters An array of parameters
|
||||
* @param InputDefinition|null $definition A InputDefinition instance
|
||||
*/
|
||||
public function __construct(array $parameters, InputDefinition $definition = null)
|
||||
{
|
||||
@@ -41,9 +41,7 @@ class ArrayInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first argument from the raw parameters (not parsed).
|
||||
*
|
||||
* @return string The value of the first argument or null otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFirstArgument()
|
||||
{
|
||||
@@ -57,15 +55,7 @@ class ArrayInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the raw parameters (not parsed) contain a value.
|
||||
*
|
||||
* This method is to be used to introspect the input parameters
|
||||
* before they have been validated. It must be used carefully.
|
||||
*
|
||||
* @param string|array $values The values to look for in the raw parameters (can be an array)
|
||||
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
||||
*
|
||||
* @return bool true if the value is contained in the raw parameters
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasParameterOption($values, $onlyParams = false)
|
||||
{
|
||||
@@ -89,16 +79,7 @@ class ArrayInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a raw option (not parsed).
|
||||
*
|
||||
* This method is to be used to introspect the input parameters
|
||||
* before they have been validated. It must be used carefully.
|
||||
*
|
||||
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
|
||||
* @param mixed $default The default value to return if no result is found
|
||||
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
||||
*
|
||||
* @return mixed The option value
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParameterOption($values, $default = false, $onlyParams = false)
|
||||
{
|
||||
@@ -141,7 +122,7 @@ class ArrayInput extends Input
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes command line arguments.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function parse()
|
||||
{
|
||||
|
68
vendor/symfony/console/Input/Input.php
vendored
68
vendor/symfony/console/Input/Input.php
vendored
@@ -38,7 +38,7 @@ abstract class Input implements InputInterface
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param InputDefinition $definition A InputDefinition instance
|
||||
* @param InputDefinition|null $definition A InputDefinition instance
|
||||
*/
|
||||
public function __construct(InputDefinition $definition = null)
|
||||
{
|
||||
@@ -51,9 +51,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds the current Input instance with the given arguments and options.
|
||||
*
|
||||
* @param InputDefinition $definition A InputDefinition instance
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bind(InputDefinition $definition)
|
||||
{
|
||||
@@ -70,9 +68,7 @@ abstract class Input implements InputInterface
|
||||
abstract protected function parse();
|
||||
|
||||
/**
|
||||
* Validates the input.
|
||||
*
|
||||
* @throws RuntimeException When not enough arguments are given
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
@@ -89,9 +85,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the input is interactive.
|
||||
*
|
||||
* @return bool Returns true if the input is interactive
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isInteractive()
|
||||
{
|
||||
@@ -99,9 +93,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the input interactivity.
|
||||
*
|
||||
* @param bool $interactive If the input should be interactive
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setInteractive($interactive)
|
||||
{
|
||||
@@ -109,9 +101,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the argument values.
|
||||
*
|
||||
* @return array An array of argument values
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getArguments()
|
||||
{
|
||||
@@ -119,13 +109,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the argument value for a given argument name.
|
||||
*
|
||||
* @param string $name The argument name
|
||||
*
|
||||
* @return mixed The argument value
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getArgument($name)
|
||||
{
|
||||
@@ -137,12 +121,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an argument value by name.
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param string $value The argument value
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setArgument($name, $value)
|
||||
{
|
||||
@@ -154,11 +133,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if an InputArgument object exists by name or position.
|
||||
*
|
||||
* @param string|int $name The InputArgument name or position
|
||||
*
|
||||
* @return bool true if the InputArgument object exists, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasArgument($name)
|
||||
{
|
||||
@@ -166,9 +141,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the options values.
|
||||
*
|
||||
* @return array An array of option values
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
@@ -176,13 +149,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the option value for a given option name.
|
||||
*
|
||||
* @param string $name The option name
|
||||
*
|
||||
* @return mixed The option value
|
||||
*
|
||||
* @throws InvalidArgumentException When option given doesn't exist
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOption($name)
|
||||
{
|
||||
@@ -194,12 +161,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an option value by name.
|
||||
*
|
||||
* @param string $name The option name
|
||||
* @param string|bool $value The option value
|
||||
*
|
||||
* @throws InvalidArgumentException When option given doesn't exist
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
@@ -211,11 +173,7 @@ abstract class Input implements InputInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if an InputOption object exists by name.
|
||||
*
|
||||
* @param string $name The InputOption name
|
||||
*
|
||||
* @return bool true if the InputOption object exists, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasOption($name)
|
||||
{
|
||||
|
25
vendor/symfony/console/Input/InputInterface.php
vendored
25
vendor/symfony/console/Input/InputInterface.php
vendored
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\Console\Input;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
|
||||
/**
|
||||
* InputInterface is the interface implemented by all input classes.
|
||||
*
|
||||
@@ -60,11 +63,9 @@ interface InputInterface
|
||||
public function bind(InputDefinition $definition);
|
||||
|
||||
/**
|
||||
* Validates if arguments given are correct.
|
||||
* Validates the input.
|
||||
*
|
||||
* Throws an exception when not enough arguments are given.
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* @throws RuntimeException When not enough arguments are given
|
||||
*/
|
||||
public function validate();
|
||||
|
||||
@@ -76,11 +77,13 @@ interface InputInterface
|
||||
public function getArguments();
|
||||
|
||||
/**
|
||||
* Gets argument by name.
|
||||
* Returns the argument value for a given argument name.
|
||||
*
|
||||
* @param string $name The name of the argument
|
||||
* @param string $name The argument name
|
||||
*
|
||||
* @return mixed
|
||||
* @return mixed The argument value
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
public function getArgument($name);
|
||||
|
||||
@@ -111,11 +114,13 @@ interface InputInterface
|
||||
public function getOptions();
|
||||
|
||||
/**
|
||||
* Gets an option by name.
|
||||
* Returns the option value for a given option name.
|
||||
*
|
||||
* @param string $name The name of the option
|
||||
* @param string $name The option name
|
||||
*
|
||||
* @return mixed
|
||||
* @return mixed The option value
|
||||
*
|
||||
* @throws InvalidArgumentException When option given doesn't exist
|
||||
*/
|
||||
public function getOption($name);
|
||||
|
||||
|
12
vendor/symfony/console/Output/NullOutput.php
vendored
12
vendor/symfony/console/Output/NullOutput.php
vendored
@@ -73,21 +73,33 @@ class NullOutput implements OutputInterface
|
||||
return self::VERBOSITY_QUIET;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isQuiet()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isVerbose()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isVeryVerbose()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isDebug()
|
||||
{
|
||||
return false;
|
||||
|
12
vendor/symfony/console/Output/Output.php
vendored
12
vendor/symfony/console/Output/Output.php
vendored
@@ -94,21 +94,33 @@ abstract class Output implements OutputInterface
|
||||
return $this->verbosity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isQuiet()
|
||||
{
|
||||
return self::VERBOSITY_QUIET === $this->verbosity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isVerbose()
|
||||
{
|
||||
return self::VERBOSITY_VERBOSE <= $this->verbosity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isVeryVerbose()
|
||||
{
|
||||
return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isDebug()
|
||||
{
|
||||
return self::VERBOSITY_DEBUG <= $this->verbosity;
|
||||
|
@@ -68,6 +68,16 @@ class ChoiceQuestion extends Question
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the choices are multiselect.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMultiselect()
|
||||
{
|
||||
return $this->multiselect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the prompt for choices.
|
||||
*
|
||||
|
BIN
vendor/symfony/console/Resources/bin/hiddeninput.exe
vendored
Normal file
BIN
vendor/symfony/console/Resources/bin/hiddeninput.exe
vendored
Normal file
Binary file not shown.
117
vendor/symfony/console/Style/SymfonyStyle.php
vendored
117
vendor/symfony/console/Style/SymfonyStyle.php
vendored
@@ -18,7 +18,6 @@ use Symfony\Component\Console\Helper\Helper;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Helper\TableCell;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -66,53 +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);
|
||||
$indentLength = 0;
|
||||
$lines = array();
|
||||
|
||||
if (null !== $type) {
|
||||
$typePrefix = sprintf('[%s] ', $type);
|
||||
$indentLength = strlen($typePrefix);
|
||||
$lineIndentation = str_repeat(' ', $indentLength);
|
||||
}
|
||||
|
||||
// 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) - $indentLength, PHP_EOL, true)));
|
||||
|
||||
// prefix each line with a number of spaces equivalent to the type length
|
||||
if (null !== $type) {
|
||||
foreach ($lines as &$line) {
|
||||
$line = $lineIndentation === substr($line, 0, $indentLength) ? $line : $lineIndentation.$line;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($messages) > 1 && $key < count($messages) - 1) {
|
||||
$lines[] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $type) {
|
||||
$lines[0] = substr_replace($lines[0], $typePrefix, 0, $indentLength);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -177,11 +133,10 @@ class SymfonyStyle extends OutputStyle
|
||||
public function comment($message)
|
||||
{
|
||||
$messages = is_array($message) ? array_values($message) : array($message);
|
||||
foreach ($messages as &$message) {
|
||||
$message = $this->getFormatter()->format($message);
|
||||
}
|
||||
|
||||
$this->block($messages, null, null, ' // ');
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,21 +184,13 @@ class SymfonyStyle extends OutputStyle
|
||||
*/
|
||||
public function table(array $headers, array $rows)
|
||||
{
|
||||
array_walk_recursive($headers, function (&$value) {
|
||||
if ($value instanceof TableCell) {
|
||||
$value = new TableCell(sprintf('<info>%s</>', $value), array(
|
||||
'colspan' => $value->getColspan(),
|
||||
'rowspan' => $value->getRowspan(),
|
||||
));
|
||||
} else {
|
||||
$value = sprintf('<info>%s</>', $value);
|
||||
}
|
||||
});
|
||||
$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();
|
||||
@@ -437,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;
|
||||
}
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ class ApplicationTester
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Application $application An Application instance to test.
|
||||
* @param Application $application An Application instance to test
|
||||
*/
|
||||
public function __construct(Application $application)
|
||||
{
|
||||
|
@@ -32,7 +32,7 @@ class CommandTester
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Command $command A Command instance to test.
|
||||
* @param Command $command A Command instance to test
|
||||
*/
|
||||
public function __construct(Command $command)
|
||||
{
|
||||
|
@@ -425,7 +425,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
$application->add(new \FooCommand());
|
||||
$application->add(new \Foo1Command());
|
||||
$application->add(new \Foo2Command());
|
||||
$application->add(new \foo3Command());
|
||||
$application->add(new \Foo3Command());
|
||||
|
||||
try {
|
||||
$application->find('Unknown-namespace:Unknown-command');
|
||||
|
@@ -4,10 +4,9 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
//Ensure that all lines are aligned to the begin of the first one and start with '//' in a very long line comment
|
||||
// ensure long words are properly wrapped in blocks
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->comment(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'
|
||||
);
|
||||
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon';
|
||||
$sfStyle = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
|
||||
};
|
||||
|
13
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php
vendored
Normal file
13
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that all lines are aligned to the begin of the first one and start with '//' in a very long line comment
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->comment(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'
|
||||
);
|
||||
};
|
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_13.php
vendored
Normal file
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_13.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
// ensure that nested tags have no effect on the color of the '//' prefix
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output->setDecorated(true);
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output->comment(
|
||||
'Lorem ipsum dolor sit <comment>amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</comment> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'
|
||||
);
|
||||
};
|
17
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_14.php
vendored
Normal file
17
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_14.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that block() behaves properly with a prefix and without type
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->block(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
||||
null,
|
||||
null,
|
||||
'$ ',
|
||||
true
|
||||
);
|
||||
};
|
14
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_15.php
vendored
Normal file
14
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_15.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that block() behaves properly with a type and without prefix
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->block(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
||||
'TEST'
|
||||
);
|
||||
};
|
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php
vendored
Normal file
15
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
|
||||
|
||||
// ensure that block() output is properly formatted (even padding lines)
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output->setDecorated(true);
|
||||
$output = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$output->success(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
||||
'TEST'
|
||||
);
|
||||
};
|
@@ -1,6 +1,4 @@
|
||||
|
||||
// Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
// aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
// Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
|
||||
// sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
||||
§ [CUSTOM] Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophatto
|
||||
§ peristeralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon
|
||||
|
||||
|
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt
vendored
Normal file
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
// Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
// aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
// Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
|
||||
// sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
||||
|
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt
vendored
Normal file
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
[39;49m // [39;49mLorem ipsum dolor sit [33mamet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et [39m
|
||||
[39;49m // [39;49m[33mdolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea [39m
|
||||
[39;49m // [39;49m[33mcommodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla [39m
|
||||
[39;49m // [39;49m[33mpariatur.[39m Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim
|
||||
[39;49m // [39;49mid est laborum
|
||||
|
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_14.txt
vendored
Normal file
6
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_14.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
$ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
$ aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
$ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
||||
$ occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
||||
|
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_15.txt
vendored
Normal file
7
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_15.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
[TEST] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
||||
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
||||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
|
||||
laborum
|
||||
|
8
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt
vendored
Normal file
8
vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
[30;42m [39;49m
|
||||
[30;42m [OK] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore [39;49m
|
||||
[30;42m magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo [39;49m
|
||||
[30;42m consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. [39;49m
|
||||
[30;42m Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum [39;49m
|
||||
[30;42m [39;49m
|
||||
|
@@ -29,7 +29,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 1 [->--------------------------]').
|
||||
$this->generateOutput(' 0 [>---------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -44,7 +44,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 1 [->--------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -58,7 +58,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 5 [----->----------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -73,7 +73,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 3 [--->------------------------]').
|
||||
$this->generateOutput(' 5 [----->----------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -89,7 +89,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 9/10 [=========================>--] 90%').
|
||||
' 9/10 [=========================>--] 90%'.
|
||||
$this->generateOutput(' 10/10 [============================] 100%').
|
||||
$this->generateOutput(' 11/11 [============================] 100%'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -99,7 +99,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
public function testFormat()
|
||||
{
|
||||
$expected =
|
||||
$this->generateOutput(' 0/10 [>---------------------------] 0%').
|
||||
' 0/10 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 10/10 [============================] 100%').
|
||||
$this->generateOutput(' 10/10 [============================] 100%')
|
||||
;
|
||||
@@ -156,7 +156,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/10 [/ ] 0%').
|
||||
' 0/10 [/ ] 0%'.
|
||||
$this->generateOutput(' 1/10 [_/ ] 10%'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -169,7 +169,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%'),
|
||||
' 0/50 [>---------------------------] 0%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 50/50 [============================] 100%'),
|
||||
' 50/50 [============================] 100%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 1/50 [>---------------------------] 2%').
|
||||
$this->generateOutput(' 2/50 [=>--------------------------] 4%'),
|
||||
@@ -230,7 +230,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 1/50 [>---------------------------] 2%').
|
||||
$this->generateOutput(' 2/50 [=>--------------------------]'),
|
||||
@@ -247,7 +247,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------]').
|
||||
' 0/50 [>---------------------------]'.
|
||||
$this->generateOutput(' 1/50 [>---------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -264,7 +264,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 1/50 [>---------------------------] 2%').
|
||||
$this->generateOutput(' 15/50 [========>-------------------] 30%').
|
||||
@@ -336,7 +336,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]').
|
||||
' 0 [>---------------------------]'.
|
||||
$this->generateOutput(' 3 [■■■>------------------------]'),
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
@@ -351,7 +351,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/50 [>---------------------------] 0%').
|
||||
' 0/50 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 25/50 [==============>-------------] 50%').
|
||||
$this->generateOutput(''),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -368,7 +368,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/200 [>---------------------------] 0%').
|
||||
' 0/200 [>---------------------------] 0%'.
|
||||
$this->generateOutput(' 0/200 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 199/200 [===========================>] 99%').
|
||||
$this->generateOutput(' 200/200 [============================] 100%'),
|
||||
@@ -468,9 +468,9 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/2 [>---------------------------] 0%')."\n".
|
||||
$this->generateOutput(' 0/3 [#---------------------------] 0%')."\n".
|
||||
rtrim($this->generateOutput(' 0 [>---------------------------]')).
|
||||
' 0/2 [>---------------------------] 0%'."\n".
|
||||
' 0/3 [#---------------------------] 0%'."\n".
|
||||
rtrim(' 0 [>---------------------------]').
|
||||
|
||||
"\033[2A".
|
||||
$this->generateOutput(' 1/2 [==============>-------------] 50%')."\n".
|
||||
@@ -508,7 +508,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
rtrim($this->generateOutput(' 0 [>---------------------------]')).
|
||||
rtrim(' 0 [>---------------------------]').
|
||||
rtrim($this->generateOutput(' 1 [->--------------------------]')).
|
||||
rtrim($this->generateOutput(' 2 [-->-------------------------]')).
|
||||
rtrim($this->generateOutput(' 3 [--->------------------------]')).
|
||||
@@ -531,7 +531,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 3 [>---------------------------]').
|
||||
' 3 [>---------------------------]'.
|
||||
$this->generateOutput(' 2 [=========>------------------]').
|
||||
$this->generateOutput(' 0 [============================]'),
|
||||
stream_get_contents($output->getStream())
|
||||
@@ -550,7 +550,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(">---------------------------\nfoobar").
|
||||
">---------------------------\nfoobar".
|
||||
$this->generateOutput("=========>------------------\nfoobar").
|
||||
"\x0D\x1B[2K\x1B[1A\x1B[2K".
|
||||
$this->generateOutput("============================\nfoobar"),
|
||||
@@ -582,11 +582,11 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(
|
||||
|
||||
" \033[44;37m Starting the demo... fingers crossed \033[0m\n".
|
||||
' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n".
|
||||
" \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m"
|
||||
).
|
||||
.
|
||||
$this->generateOutput(
|
||||
" \033[44;37m Looks good to me... \033[0m\n".
|
||||
' 4/15 '.str_repeat($done, 7).$progress.str_repeat($empty, 19)." 26%\n".
|
||||
@@ -608,7 +608,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
$bar->start();
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0 [>---------------------------]'),
|
||||
' 0 [>---------------------------]',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
|
||||
@@ -617,7 +617,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
$bar->start();
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
$this->generateOutput(' 0/10 [>---------------------------] 0%'),
|
||||
' 0/10 [>---------------------------] 0%',
|
||||
stream_get_contents($output->getStream())
|
||||
);
|
||||
}
|
||||
|
109
vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php
vendored
Normal file
109
vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Console\Tests\Helper;
|
||||
|
||||
use Symfony\Component\Console\Helper\FormatterHelper;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
|
||||
/**
|
||||
* @group tty
|
||||
*/
|
||||
class SymfonyQuestionHelperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAskChoice()
|
||||
{
|
||||
$questionHelper = new SymfonyQuestionHelper();
|
||||
|
||||
$helperSet = new HelperSet(array(new FormatterHelper()));
|
||||
$questionHelper->setHelperSet($helperSet);
|
||||
|
||||
$heroes = array('Superman', 'Batman', 'Spiderman');
|
||||
|
||||
$questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2');
|
||||
$question->setMaxAttempts(1);
|
||||
// first answer is an empty answer, we're supposed to receive the default value
|
||||
$this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('What is your favorite superhero? [Spiderman]', $output);
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
|
||||
$question->setMaxAttempts(1);
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
|
||||
$question->setErrorMessage('Input "%s" is not a superhero!');
|
||||
$question->setMaxAttempts(2);
|
||||
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('Input "Fabien" is not a superhero!', $output);
|
||||
|
||||
try {
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1');
|
||||
$question->setMaxAttempts(1);
|
||||
$questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question);
|
||||
$this->fail();
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->assertEquals('Value "Fabien" is invalid', $e->getMessage());
|
||||
}
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1');
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output);
|
||||
|
||||
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 ');
|
||||
$question->setMaxAttempts(1);
|
||||
$question->setMultiselect(true);
|
||||
|
||||
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
|
||||
$this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output);
|
||||
}
|
||||
|
||||
protected function getInputStream($input)
|
||||
{
|
||||
$stream = fopen('php://memory', 'r+', false);
|
||||
fwrite($stream, $input);
|
||||
rewind($stream);
|
||||
|
||||
return $stream;
|
||||
}
|
||||
|
||||
protected function createOutputInterface()
|
||||
{
|
||||
$output = new StreamOutput(fopen('php://memory', 'r+', false));
|
||||
$output->setDecorated(false);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function createInputInterfaceMock($interactive = true)
|
||||
{
|
||||
$mock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
private function assertOutputContains($expected, StreamOutput $output)
|
||||
{
|
||||
rewind($output->getStream());
|
||||
$stream = stream_get_contents($output->getStream());
|
||||
$this->assertContains($expected, $stream);
|
||||
}
|
||||
}
|
@@ -631,6 +631,25 @@ TABLE;
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Symfony\Component\Console\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Style "absent" is not defined.
|
||||
*/
|
||||
public function testIsNotDefinedStyleException()
|
||||
{
|
||||
$table = new Table($this->getOutputStream());
|
||||
$table->setStyle('absent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Style "absent" is not defined.
|
||||
*/
|
||||
public function testGetStyleDefinition()
|
||||
{
|
||||
Table::getStyleDefinition('absent');
|
||||
}
|
||||
|
||||
protected function getOutputStream()
|
||||
{
|
||||
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false);
|
||||
|
@@ -183,7 +183,17 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar'),
|
||||
new InputDefinition(),
|
||||
'Too many arguments.',
|
||||
'No arguments expected, got "foo".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar'),
|
||||
new InputDefinition(array(new InputArgument('number'))),
|
||||
'Too many arguments, expected arguments "number".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar', 'zzz'),
|
||||
new InputDefinition(array(new InputArgument('number'), new InputArgument('county'))),
|
||||
'Too many arguments, expected arguments "number" "county".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '--foo'),
|
||||
|
@@ -19,7 +19,10 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $fixtures;
|
||||
|
||||
protected $foo, $bar, $foo1, $foo2;
|
||||
protected $foo;
|
||||
protected $bar;
|
||||
protected $foo1;
|
||||
protected $foo2;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
|
@@ -54,22 +54,6 @@ class SymfonyStyleTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt'));
|
||||
}
|
||||
|
||||
public function testLongWordsBlockWrapping()
|
||||
{
|
||||
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygovgollhjvhvljfezefeqifzeiqgiqzhrsdgihqzridghqridghqirshdghdghieridgheirhsdgehrsdvhqrsidhqshdgihrsidvqhneriqsdvjzergetsrfhgrstsfhsetsfhesrhdgtesfhbzrtfbrztvetbsdfbrsdfbrn';
|
||||
$wordLength = strlen($word);
|
||||
$maxLineLength = SymfonyStyle::MAX_LINE_LENGTH - 3;
|
||||
|
||||
$this->command->setCode(function (InputInterface $input, OutputInterface $output) use ($word) {
|
||||
$sfStyle = new SymfonyStyleWithForcedLineLength($input, $output);
|
||||
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
|
||||
});
|
||||
|
||||
$this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
|
||||
$expectedCount = (int) ceil($wordLength / ($maxLineLength)) + (int) ($wordLength > $maxLineLength - 5);
|
||||
$this->assertSame($expectedCount, substr_count($this->tester->getDisplay(true), ' § '));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user