summaryrefslogtreecommitdiff
path: root/vendor/symfony/console/Input
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/console/Input')
-rw-r--r--vendor/symfony/console/Input/ArgvInput.php351
-rw-r--r--vendor/symfony/console/Input/ArrayInput.php210
-rw-r--r--vendor/symfony/console/Input/Input.php236
-rw-r--r--vendor/symfony/console/Input/InputArgument.php131
-rw-r--r--vendor/symfony/console/Input/InputAwareInterface.php28
-rw-r--r--vendor/symfony/console/Input/InputDefinition.php457
-rw-r--r--vendor/symfony/console/Input/InputInterface.php152
-rw-r--r--vendor/symfony/console/Input/InputOption.php212
-rw-r--r--vendor/symfony/console/Input/StringInput.php85
9 files changed, 1862 insertions, 0 deletions
diff --git a/vendor/symfony/console/Input/ArgvInput.php b/vendor/symfony/console/Input/ArgvInput.php
new file mode 100644
index 00000000..02d4cdb3
--- /dev/null
+++ b/vendor/symfony/console/Input/ArgvInput.php
@@ -0,0 +1,351 @@
+<?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\Input;
+
+use Symfony\Component\Console\Exception\RuntimeException;
+
+/**
+ * ArgvInput represents an input coming from the CLI arguments.
+ *
+ * Usage:
+ *
+ * $input = new ArgvInput();
+ *
+ * By default, the `$_SERVER['argv']` array is used for the input values.
+ *
+ * This can be overridden by explicitly passing the input values in the constructor:
+ *
+ * $input = new ArgvInput($_SERVER['argv']);
+ *
+ * If you pass it yourself, don't forget that the first element of the array
+ * is the name of the running application.
+ *
+ * When passing an argument to the constructor, be sure that it respects
+ * the same rules as the argv one. It's almost always better to use the
+ * `StringInput` when you want to provide your own input.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @see http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
+ * @see http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02
+ */
+class ArgvInput extends Input
+{
+ private $tokens;
+ private $parsed;
+
+ /**
+ * Constructor.
+ *
+ * @param array $argv An array of parameters from the CLI (in the argv format)
+ * @param InputDefinition $definition A InputDefinition instance
+ */
+ public function __construct(array $argv = null, InputDefinition $definition = null)
+ {
+ if (null === $argv) {
+ $argv = $_SERVER['argv'];
+ }
+
+ // strip the application name
+ array_shift($argv);
+
+ $this->tokens = $argv;
+
+ parent::__construct($definition);
+ }
+
+ protected function setTokens(array $tokens)
+ {
+ $this->tokens = $tokens;
+ }
+
+ /**
+ * Processes command line arguments.
+ */
+ protected function parse()
+ {
+ $parseOptions = true;
+ $this->parsed = $this->tokens;
+ while (null !== $token = array_shift($this->parsed)) {
+ if ($parseOptions && '' == $token) {
+ $this->parseArgument($token);
+ } elseif ($parseOptions && '--' == $token) {
+ $parseOptions = false;
+ } elseif ($parseOptions && 0 === strpos($token, '--')) {
+ $this->parseLongOption($token);
+ } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
+ $this->parseShortOption($token);
+ } else {
+ $this->parseArgument($token);
+ }
+ }
+ }
+
+ /**
+ * Parses a short option.
+ *
+ * @param string $token The current token.
+ */
+ private function parseShortOption($token)
+ {
+ $name = substr($token, 1);
+
+ if (strlen($name) > 1) {
+ if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
+ // an option with a value (with no space)
+ $this->addShortOption($name[0], substr($name, 1));
+ } else {
+ $this->parseShortOptionSet($name);
+ }
+ } else {
+ $this->addShortOption($name, null);
+ }
+ }
+
+ /**
+ * Parses a short option set.
+ *
+ * @param string $name The current token
+ *
+ * @throws RuntimeException When option given doesn't exist
+ */
+ private function parseShortOptionSet($name)
+ {
+ $len = strlen($name);
+ for ($i = 0; $i < $len; ++$i) {
+ if (!$this->definition->hasShortcut($name[$i])) {
+ throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
+ }
+
+ $option = $this->definition->getOptionForShortcut($name[$i]);
+ if ($option->acceptValue()) {
+ $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
+
+ break;
+ } else {
+ $this->addLongOption($option->getName(), null);
+ }
+ }
+ }
+
+ /**
+ * Parses a long option.
+ *
+ * @param string $token The current token
+ */
+ private function parseLongOption($token)
+ {
+ $name = substr($token, 2);
+
+ if (false !== $pos = strpos($name, '=')) {
+ $this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1));
+ } else {
+ $this->addLongOption($name, null);
+ }
+ }
+
+ /**
+ * Parses an argument.
+ *
+ * @param string $token The current token
+ *
+ * @throws RuntimeException When too many arguments are given
+ */
+ private function parseArgument($token)
+ {
+ $c = count($this->arguments);
+
+ // if input is expecting another argument, add it
+ if ($this->definition->hasArgument($c)) {
+ $arg = $this->definition->getArgument($c);
+ $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
+
+ // if last argument isArray(), append token to last argument
+ } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
+ $arg = $this->definition->getArgument($c - 1);
+ $this->arguments[$arg->getName()][] = $token;
+
+ // unexpected argument
+ } else {
+ throw new RuntimeException('Too many arguments.');
+ }
+ }
+
+ /**
+ * Adds a short option value.
+ *
+ * @param string $shortcut The short option key
+ * @param mixed $value The value for the option
+ *
+ * @throws RuntimeException When option given doesn't exist
+ */
+ private function addShortOption($shortcut, $value)
+ {
+ if (!$this->definition->hasShortcut($shortcut)) {
+ throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
+ }
+
+ $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
+ }
+
+ /**
+ * Adds a long option value.
+ *
+ * @param string $name The long option key
+ * @param mixed $value The value for the option
+ *
+ * @throws RuntimeException When option given doesn't exist
+ */
+ private function addLongOption($name, $value)
+ {
+ if (!$this->definition->hasOption($name)) {
+ throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
+ }
+
+ $option = $this->definition->getOption($name);
+
+ // Convert empty values to null
+ if (!isset($value[0])) {
+ $value = null;
+ }
+
+ if (null !== $value && !$option->acceptValue()) {
+ throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
+ }
+
+ if (null === $value && $option->acceptValue() && count($this->parsed)) {
+ // if option accepts an optional or mandatory argument
+ // let's see if there is one provided
+ $next = array_shift($this->parsed);
+ if (isset($next[0]) && '-' !== $next[0]) {
+ $value = $next;
+ } elseif (empty($next)) {
+ $value = '';
+ } else {
+ array_unshift($this->parsed, $next);
+ }
+ }
+
+ if (null === $value) {
+ if ($option->isValueRequired()) {
+ throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
+ }
+
+ if (!$option->isArray()) {
+ $value = $option->isValueOptional() ? $option->getDefault() : true;
+ }
+ }
+
+ if ($option->isArray()) {
+ $this->options[$name][] = $value;
+ } else {
+ $this->options[$name] = $value;
+ }
+ }
+
+ /**
+ * Returns the first argument from the raw parameters (not parsed).
+ *
+ * @return string The value of the first argument or null otherwise
+ */
+ public function getFirstArgument()
+ {
+ foreach ($this->tokens as $token) {
+ if ($token && '-' === $token[0]) {
+ continue;
+ }
+
+ return $token;
+ }
+ }
+
+ /**
+ * 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)
+ *
+ * @return bool true if the value is contained in the raw parameters
+ */
+ public function hasParameterOption($values)
+ {
+ $values = (array) $values;
+
+ foreach ($this->tokens as $token) {
+ foreach ($values as $value) {
+ if ($token === $value || 0 === strpos($token, $value.'=')) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * 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
+ *
+ * @return mixed The option value
+ */
+ public function getParameterOption($values, $default = false)
+ {
+ $values = (array) $values;
+ $tokens = $this->tokens;
+
+ while (0 < count($tokens)) {
+ $token = array_shift($tokens);
+
+ foreach ($values as $value) {
+ if ($token === $value || 0 === strpos($token, $value.'=')) {
+ if (false !== $pos = strpos($token, '=')) {
+ return substr($token, $pos + 1);
+ }
+
+ return array_shift($tokens);
+ }
+ }
+ }
+
+ return $default;
+ }
+
+ /**
+ * Returns a stringified representation of the args passed to the command.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ $self = $this;
+ $tokens = array_map(function ($token) use ($self) {
+ if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
+ return $match[1].$self->escapeToken($match[2]);
+ }
+
+ if ($token && $token[0] !== '-') {
+ return $self->escapeToken($token);
+ }
+
+ return $token;
+ }, $this->tokens);
+
+ return implode(' ', $tokens);
+ }
+}
diff --git a/vendor/symfony/console/Input/ArrayInput.php b/vendor/symfony/console/Input/ArrayInput.php
new file mode 100644
index 00000000..8cedbb37
--- /dev/null
+++ b/vendor/symfony/console/Input/ArrayInput.php
@@ -0,0 +1,210 @@
+<?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\Input;
+
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Exception\InvalidOptionException;
+
+/**
+ * ArrayInput represents an input provided as an array.
+ *
+ * Usage:
+ *
+ * $input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar'));
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class ArrayInput extends Input
+{
+ private $parameters;
+
+ /**
+ * Constructor.
+ *
+ * @param array $parameters An array of parameters
+ * @param InputDefinition $definition A InputDefinition instance
+ */
+ public function __construct(array $parameters, InputDefinition $definition = null)
+ {
+ $this->parameters = $parameters;
+
+ parent::__construct($definition);
+ }
+
+ /**
+ * Returns the first argument from the raw parameters (not parsed).
+ *
+ * @return string The value of the first argument or null otherwise
+ */
+ public function getFirstArgument()
+ {
+ foreach ($this->parameters as $key => $value) {
+ if ($key && '-' === $key[0]) {
+ continue;
+ }
+
+ return $value;
+ }
+ }
+
+ /**
+ * 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)
+ *
+ * @return bool true if the value is contained in the raw parameters
+ */
+ public function hasParameterOption($values)
+ {
+ $values = (array) $values;
+
+ foreach ($this->parameters as $k => $v) {
+ if (!is_int($k)) {
+ $v = $k;
+ }
+
+ if (in_array($v, $values)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * 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
+ *
+ * @return mixed The option value
+ */
+ public function getParameterOption($values, $default = false)
+ {
+ $values = (array) $values;
+
+ foreach ($this->parameters as $k => $v) {
+ if (is_int($k)) {
+ if (in_array($v, $values)) {
+ return true;
+ }
+ } elseif (in_array($k, $values)) {
+ return $v;
+ }
+ }
+
+ return $default;
+ }
+
+ /**
+ * Returns a stringified representation of the args passed to the command.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ $params = array();
+ foreach ($this->parameters as $param => $val) {
+ if ($param && '-' === $param[0]) {
+ $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
+ } else {
+ $params[] = $this->escapeToken($val);
+ }
+ }
+
+ return implode(' ', $params);
+ }
+
+ /**
+ * Processes command line arguments.
+ */
+ protected function parse()
+ {
+ foreach ($this->parameters as $key => $value) {
+ if (0 === strpos($key, '--')) {
+ $this->addLongOption(substr($key, 2), $value);
+ } elseif ('-' === $key[0]) {
+ $this->addShortOption(substr($key, 1), $value);
+ } else {
+ $this->addArgument($key, $value);
+ }
+ }
+ }
+
+ /**
+ * Adds a short option value.
+ *
+ * @param string $shortcut The short option key
+ * @param mixed $value The value for the option
+ *
+ * @throws InvalidOptionException When option given doesn't exist
+ */
+ private function addShortOption($shortcut, $value)
+ {
+ if (!$this->definition->hasShortcut($shortcut)) {
+ throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
+ }
+
+ $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
+ }
+
+ /**
+ * Adds a long option value.
+ *
+ * @param string $name The long option key
+ * @param mixed $value The value for the option
+ *
+ * @throws InvalidOptionException When option given doesn't exist
+ * @throws InvalidOptionException When a required value is missing
+ */
+ private function addLongOption($name, $value)
+ {
+ if (!$this->definition->hasOption($name)) {
+ throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
+ }
+
+ $option = $this->definition->getOption($name);
+
+ if (null === $value) {
+ if ($option->isValueRequired()) {
+ throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
+ }
+
+ $value = $option->isValueOptional() ? $option->getDefault() : true;
+ }
+
+ $this->options[$name] = $value;
+ }
+
+ /**
+ * Adds an argument value.
+ *
+ * @param string $name The argument name
+ * @param mixed $value The value for the argument
+ *
+ * @throws InvalidArgumentException When argument given doesn't exist
+ */
+ private function addArgument($name, $value)
+ {
+ if (!$this->definition->hasArgument($name)) {
+ throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
+ }
+
+ $this->arguments[$name] = $value;
+ }
+}
diff --git a/vendor/symfony/console/Input/Input.php b/vendor/symfony/console/Input/Input.php
new file mode 100644
index 00000000..85499fc4
--- /dev/null
+++ b/vendor/symfony/console/Input/Input.php
@@ -0,0 +1,236 @@
+<?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\Input;
+
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Exception\RuntimeException;
+
+/**
+ * Input is the base class for all concrete Input classes.
+ *
+ * Three concrete classes are provided by default:
+ *
+ * * `ArgvInput`: The input comes from the CLI arguments (argv)
+ * * `StringInput`: The input is provided as a string
+ * * `ArrayInput`: The input is provided as an array
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+abstract class Input implements InputInterface
+{
+ /**
+ * @var InputDefinition
+ */
+ protected $definition;
+ protected $options = array();
+ protected $arguments = array();
+ protected $interactive = true;
+
+ /**
+ * Constructor.
+ *
+ * @param InputDefinition $definition A InputDefinition instance
+ */
+ public function __construct(InputDefinition $definition = null)
+ {
+ if (null === $definition) {
+ $this->definition = new InputDefinition();
+ } else {
+ $this->bind($definition);
+ $this->validate();
+ }
+ }
+
+ /**
+ * Binds the current Input instance with the given arguments and options.
+ *
+ * @param InputDefinition $definition A InputDefinition instance
+ */
+ public function bind(InputDefinition $definition)
+ {
+ $this->arguments = array();
+ $this->options = array();
+ $this->definition = $definition;
+
+ $this->parse();
+ }
+
+ /**
+ * Processes command line arguments.
+ */
+ abstract protected function parse();
+
+ /**
+ * Validates the input.
+ *
+ * @throws RuntimeException When not enough arguments are given
+ */
+ public function validate()
+ {
+ $definition = $this->definition;
+ $givenArguments = $this->arguments;
+
+ $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
+ return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
+ });
+
+ if (count($missingArguments) > 0) {
+ throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
+ }
+ }
+
+ /**
+ * Checks if the input is interactive.
+ *
+ * @return bool Returns true if the input is interactive
+ */
+ public function isInteractive()
+ {
+ return $this->interactive;
+ }
+
+ /**
+ * Sets the input interactivity.
+ *
+ * @param bool $interactive If the input should be interactive
+ */
+ public function setInteractive($interactive)
+ {
+ $this->interactive = (bool) $interactive;
+ }
+
+ /**
+ * Returns the argument values.
+ *
+ * @return array An array of argument values
+ */
+ public function getArguments()
+ {
+ return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
+ }
+
+ /**
+ * 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
+ */
+ public function getArgument($name)
+ {
+ if (!$this->definition->hasArgument($name)) {
+ throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
+ }
+
+ return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
+ }
+
+ /**
+ * 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
+ */
+ public function setArgument($name, $value)
+ {
+ if (!$this->definition->hasArgument($name)) {
+ throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
+ }
+
+ $this->arguments[$name] = $value;
+ }
+
+ /**
+ * 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
+ */
+ public function hasArgument($name)
+ {
+ return $this->definition->hasArgument($name);
+ }
+
+ /**
+ * Returns the options values.
+ *
+ * @return array An array of option values
+ */
+ public function getOptions()
+ {
+ return array_merge($this->definition->getOptionDefaults(), $this->options);
+ }
+
+ /**
+ * 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
+ */
+ public function getOption($name)
+ {
+ if (!$this->definition->hasOption($name)) {
+ throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
+ }
+
+ return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
+ }
+
+ /**
+ * 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
+ */
+ public function setOption($name, $value)
+ {
+ if (!$this->definition->hasOption($name)) {
+ throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
+ }
+
+ $this->options[$name] = $value;
+ }
+
+ /**
+ * 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
+ */
+ public function hasOption($name)
+ {
+ return $this->definition->hasOption($name);
+ }
+
+ /**
+ * Escapes a token through escapeshellarg if it contains unsafe chars.
+ *
+ * @param string $token
+ *
+ * @return string
+ */
+ public function escapeToken($token)
+ {
+ return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
+ }
+}
diff --git a/vendor/symfony/console/Input/InputArgument.php b/vendor/symfony/console/Input/InputArgument.php
new file mode 100644
index 00000000..048ee4ff
--- /dev/null
+++ b/vendor/symfony/console/Input/InputArgument.php
@@ -0,0 +1,131 @@
+<?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\Input;
+
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Exception\LogicException;
+
+/**
+ * Represents a command line argument.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class InputArgument
+{
+ const REQUIRED = 1;
+ const OPTIONAL = 2;
+ const IS_ARRAY = 4;
+
+ private $name;
+ private $mode;
+ private $default;
+ private $description;
+
+ /**
+ * Constructor.
+ *
+ * @param string $name The argument name
+ * @param int $mode The argument mode: self::REQUIRED or self::OPTIONAL
+ * @param string $description A description text
+ * @param mixed $default The default value (for self::OPTIONAL mode only)
+ *
+ * @throws InvalidArgumentException When argument mode is not valid
+ */
+ public function __construct($name, $mode = null, $description = '', $default = null)
+ {
+ if (null === $mode) {
+ $mode = self::OPTIONAL;
+ } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
+ throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
+ }
+
+ $this->name = $name;
+ $this->mode = $mode;
+ $this->description = $description;
+
+ $this->setDefault($default);
+ }
+
+ /**
+ * Returns the argument name.
+ *
+ * @return string The argument name
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Returns true if the argument is required.
+ *
+ * @return bool true if parameter mode is self::REQUIRED, false otherwise
+ */
+ public function isRequired()
+ {
+ return self::REQUIRED === (self::REQUIRED & $this->mode);
+ }
+
+ /**
+ * Returns true if the argument can take multiple values.
+ *
+ * @return bool true if mode is self::IS_ARRAY, false otherwise
+ */
+ public function isArray()
+ {
+ return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
+ }
+
+ /**
+ * Sets the default value.
+ *
+ * @param mixed $default The default value
+ *
+ * @throws LogicException When incorrect default value is given
+ */
+ public function setDefault($default = null)
+ {
+ if (self::REQUIRED === $this->mode && null !== $default) {
+ throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
+ }
+
+ if ($this->isArray()) {
+ if (null === $default) {
+ $default = array();
+ } elseif (!is_array($default)) {
+ throw new LogicException('A default value for an array argument must be an array.');
+ }
+ }
+
+ $this->default = $default;
+ }
+
+ /**
+ * Returns the default value.
+ *
+ * @return mixed The default value
+ */
+ public function getDefault()
+ {
+ return $this->default;
+ }
+
+ /**
+ * Returns the description text.
+ *
+ * @return string The description text
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+}
diff --git a/vendor/symfony/console/Input/InputAwareInterface.php b/vendor/symfony/console/Input/InputAwareInterface.php
new file mode 100644
index 00000000..d0f11e98
--- /dev/null
+++ b/vendor/symfony/console/Input/InputAwareInterface.php
@@ -0,0 +1,28 @@
+<?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\Input;
+
+/**
+ * InputAwareInterface should be implemented by classes that depends on the
+ * Console Input.
+ *
+ * @author Wouter J <waldio.webdesign@gmail.com>
+ */
+interface InputAwareInterface
+{
+ /**
+ * Sets the Console Input.
+ *
+ * @param InputInterface
+ */
+ public function setInput(InputInterface $input);
+}
diff --git a/vendor/symfony/console/Input/InputDefinition.php b/vendor/symfony/console/Input/InputDefinition.php
new file mode 100644
index 00000000..bd64163b
--- /dev/null
+++ b/vendor/symfony/console/Input/InputDefinition.php
@@ -0,0 +1,457 @@
+<?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\Input;
+
+use Symfony\Component\Console\Descriptor\TextDescriptor;
+use Symfony\Component\Console\Descriptor\XmlDescriptor;
+use Symfony\Component\Console\Output\BufferedOutput;
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Exception\LogicException;
+
+/**
+ * A InputDefinition represents a set of valid command line arguments and options.
+ *
+ * Usage:
+ *
+ * $definition = new InputDefinition(array(
+ * new InputArgument('name', InputArgument::REQUIRED),
+ * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED),
+ * ));
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class InputDefinition
+{
+ private $arguments;
+ private $requiredCount;
+ private $hasAnArrayArgument = false;
+ private $hasOptional;
+ private $options;
+ private $shortcuts;
+
+ /**
+ * Constructor.
+ *
+ * @param array $definition An array of InputArgument and InputOption instance
+ */
+ public function __construct(array $definition = array())
+ {
+ $this->setDefinition($definition);
+ }
+
+ /**
+ * Sets the definition of the input.
+ *
+ * @param array $definition The definition array
+ */
+ public function setDefinition(array $definition)
+ {
+ $arguments = array();
+ $options = array();
+ foreach ($definition as $item) {
+ if ($item instanceof InputOption) {
+ $options[] = $item;
+ } else {
+ $arguments[] = $item;
+ }
+ }
+
+ $this->setArguments($arguments);
+ $this->setOptions($options);
+ }
+
+ /**
+ * Sets the InputArgument objects.
+ *
+ * @param InputArgument[] $arguments An array of InputArgument objects
+ */
+ public function setArguments($arguments = array())
+ {
+ $this->arguments = array();
+ $this->requiredCount = 0;
+ $this->hasOptional = false;
+ $this->hasAnArrayArgument = false;
+ $this->addArguments($arguments);
+ }
+
+ /**
+ * Adds an array of InputArgument objects.
+ *
+ * @param InputArgument[] $arguments An array of InputArgument objects
+ */
+ public function addArguments($arguments = array())
+ {
+ if (null !== $arguments) {
+ foreach ($arguments as $argument) {
+ $this->addArgument($argument);
+ }
+ }
+ }
+
+ /**
+ * Adds an InputArgument object.
+ *
+ * @param InputArgument $argument An InputArgument object
+ *
+ * @throws LogicException When incorrect argument is given
+ */
+ public function addArgument(InputArgument $argument)
+ {
+ if (isset($this->arguments[$argument->getName()])) {
+ throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
+ }
+
+ if ($this->hasAnArrayArgument) {
+ throw new LogicException('Cannot add an argument after an array argument.');
+ }
+
+ if ($argument->isRequired() && $this->hasOptional) {
+ throw new LogicException('Cannot add a required argument after an optional one.');
+ }
+
+ if ($argument->isArray()) {
+ $this->hasAnArrayArgument = true;
+ }
+
+ if ($argument->isRequired()) {
+ ++$this->requiredCount;
+ } else {
+ $this->hasOptional = true;
+ }
+
+ $this->arguments[$argument->getName()] = $argument;
+ }
+
+ /**
+ * Returns an InputArgument by name or by position.
+ *
+ * @param string|int $name The InputArgument name or position
+ *
+ * @return InputArgument An InputArgument object
+ *
+ * @throws InvalidArgumentException When argument given doesn't exist
+ */
+ public function getArgument($name)
+ {
+ if (!$this->hasArgument($name)) {
+ throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
+ }
+
+ $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
+
+ return $arguments[$name];
+ }
+
+ /**
+ * 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
+ */
+ public function hasArgument($name)
+ {
+ $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
+
+ return isset($arguments[$name]);
+ }
+
+ /**
+ * Gets the array of InputArgument objects.
+ *
+ * @return InputArgument[] An array of InputArgument objects
+ */
+ public function getArguments()
+ {
+ return $this->arguments;
+ }
+
+ /**
+ * Returns the number of InputArguments.
+ *
+ * @return int The number of InputArguments
+ */
+ public function getArgumentCount()
+ {
+ return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
+ }
+
+ /**
+ * Returns the number of required InputArguments.
+ *
+ * @return int The number of required InputArguments
+ */
+ public function getArgumentRequiredCount()
+ {
+ return $this->requiredCount;
+ }
+
+ /**
+ * Gets the default values.
+ *
+ * @return array An array of default values
+ */
+ public function getArgumentDefaults()
+ {
+ $values = array();
+ foreach ($this->arguments as $argument) {
+ $values[$argument->getName()] = $argument->getDefault();
+ }
+
+ return $values;
+ }
+
+ /**
+ * Sets the InputOption objects.
+ *
+ * @param InputOption[] $options An array of InputOption objects
+ */
+ public function setOptions($options = array())
+ {
+ $this->options = array();
+ $this->shortcuts = array();
+ $this->addOptions($options);
+ }
+
+ /**
+ * Adds an array of InputOption objects.
+ *
+ * @param InputOption[] $options An array of InputOption objects
+ */
+ public function addOptions($options = array())
+ {
+ foreach ($options as $option) {
+ $this->addOption($option);
+ }
+ }
+
+ /**
+ * Adds an InputOption object.
+ *
+ * @param InputOption $option An InputOption object
+ *
+ * @throws LogicException When option given already exist
+ */
+ public function addOption(InputOption $option)
+ {
+ if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
+ throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
+ }
+
+ if ($option->getShortcut()) {
+ foreach (explode('|', $option->getShortcut()) as $shortcut) {
+ if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
+ throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
+ }
+ }
+ }
+
+ $this->options[$option->getName()] = $option;
+ if ($option->getShortcut()) {
+ foreach (explode('|', $option->getShortcut()) as $shortcut) {
+ $this->shortcuts[$shortcut] = $option->getName();
+ }
+ }
+ }
+
+ /**
+ * Returns an InputOption by name.
+ *
+ * @param string $name The InputOption name
+ *
+ * @return InputOption A InputOption object
+ *
+ * @throws InvalidArgumentException When option given doesn't exist
+ */
+ public function getOption($name)
+ {
+ if (!$this->hasOption($name)) {
+ throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
+ }
+
+ return $this->options[$name];
+ }
+
+ /**
+ * 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
+ */
+ public function hasOption($name)
+ {
+ return isset($this->options[$name]);
+ }
+
+ /**
+ * Gets the array of InputOption objects.
+ *
+ * @return InputOption[] An array of InputOption objects
+ */
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ /**
+ * Returns true if an InputOption object exists by shortcut.
+ *
+ * @param string $name The InputOption shortcut
+ *
+ * @return bool true if the InputOption object exists, false otherwise
+ */
+ public function hasShortcut($name)
+ {
+ return isset($this->shortcuts[$name]);
+ }
+
+ /**
+ * Gets an InputOption by shortcut.
+ *
+ * @param string $shortcut the Shortcut name
+ *
+ * @return InputOption An InputOption object
+ */
+ public function getOptionForShortcut($shortcut)
+ {
+ return $this->getOption($this->shortcutToName($shortcut));
+ }
+
+ /**
+ * Gets an array of default values.
+ *
+ * @return array An array of all default values
+ */
+ public function getOptionDefaults()
+ {
+ $values = array();
+ foreach ($this->options as $option) {
+ $values[$option->getName()] = $option->getDefault();
+ }
+
+ return $values;
+ }
+
+ /**
+ * Returns the InputOption name given a shortcut.
+ *
+ * @param string $shortcut The shortcut
+ *
+ * @return string The InputOption name
+ *
+ * @throws InvalidArgumentException When option given does not exist
+ */
+ private function shortcutToName($shortcut)
+ {
+ if (!isset($this->shortcuts[$shortcut])) {
+ throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
+ }
+
+ return $this->shortcuts[$shortcut];
+ }
+
+ /**
+ * Gets the synopsis.
+ *
+ * @param bool $short Whether to return the short version (with options folded) or not
+ *
+ * @return string The synopsis
+ */
+ public function getSynopsis($short = false)
+ {
+ $elements = array();
+
+ if ($short && $this->getOptions()) {
+ $elements[] = '[options]';
+ } elseif (!$short) {
+ foreach ($this->getOptions() as $option) {
+ $value = '';
+ if ($option->acceptValue()) {
+ $value = sprintf(
+ ' %s%s%s',
+ $option->isValueOptional() ? '[' : '',
+ strtoupper($option->getName()),
+ $option->isValueOptional() ? ']' : ''
+ );
+ }
+
+ $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
+ $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
+ }
+ }
+
+ if (count($elements) && $this->getArguments()) {
+ $elements[] = '[--]';
+ }
+
+ foreach ($this->getArguments() as $argument) {
+ $element = '<'.$argument->getName().'>';
+ if (!$argument->isRequired()) {
+ $element = '['.$element.']';
+ } elseif ($argument->isArray()) {
+ $element = $element.' ('.$element.')';
+ }
+
+ if ($argument->isArray()) {
+ $element .= '...';
+ }
+
+ $elements[] = $element;
+ }
+
+ return implode(' ', $elements);
+ }
+
+ /**
+ * Returns a textual representation of the InputDefinition.
+ *
+ * @return string A string representing the InputDefinition
+ *
+ * @deprecated since version 2.3, to be removed in 3.0.
+ */
+ public function asText()
+ {
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
+
+ $descriptor = new TextDescriptor();
+ $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
+ $descriptor->describe($output, $this, array('raw_output' => true));
+
+ return $output->fetch();
+ }
+
+ /**
+ * Returns an XML representation of the InputDefinition.
+ *
+ * @param bool $asDom Whether to return a DOM or an XML string
+ *
+ * @return string|\DOMDocument An XML string representing the InputDefinition
+ *
+ * @deprecated since version 2.3, to be removed in 3.0.
+ */
+ public function asXml($asDom = false)
+ {
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
+
+ $descriptor = new XmlDescriptor();
+
+ if ($asDom) {
+ return $descriptor->getInputDefinitionDocument($this);
+ }
+
+ $output = new BufferedOutput();
+ $descriptor->describe($output, $this);
+
+ return $output->fetch();
+ }
+}
diff --git a/vendor/symfony/console/Input/InputInterface.php b/vendor/symfony/console/Input/InputInterface.php
new file mode 100644
index 00000000..f83b8856
--- /dev/null
+++ b/vendor/symfony/console/Input/InputInterface.php
@@ -0,0 +1,152 @@
+<?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\Input;
+
+/**
+ * InputInterface is the interface implemented by all input classes.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+interface InputInterface
+{
+ /**
+ * Returns the first argument from the raw parameters (not parsed).
+ *
+ * @return string The value of the first argument or null otherwise
+ */
+ public function getFirstArgument();
+
+ /**
+ * 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)
+ *
+ * @return bool true if the value is contained in the raw parameters
+ */
+ public function hasParameterOption($values);
+
+ /**
+ * 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
+ *
+ * @return mixed The option value
+ */
+ public function getParameterOption($values, $default = false);
+
+ /**
+ * Binds the current Input instance with the given arguments and options.
+ *
+ * @param InputDefinition $definition A InputDefinition instance
+ */
+ public function bind(InputDefinition $definition);
+
+ /**
+ * Validates if arguments given are correct.
+ *
+ * Throws an exception when not enough arguments are given.
+ *
+ * @throws \RuntimeException
+ */
+ public function validate();
+
+ /**
+ * Returns all the given arguments merged with the default values.
+ *
+ * @return array
+ */
+ public function getArguments();
+
+ /**
+ * Gets argument by name.
+ *
+ * @param string $name The name of the argument
+ *
+ * @return mixed
+ */
+ public function getArgument($name);
+
+ /**
+ * 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
+ */
+ public function setArgument($name, $value);
+
+ /**
+ * 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
+ */
+ public function hasArgument($name);
+
+ /**
+ * Returns all the given options merged with the default values.
+ *
+ * @return array
+ */
+ public function getOptions();
+
+ /**
+ * Gets an option by name.
+ *
+ * @param string $name The name of the option
+ *
+ * @return mixed
+ */
+ public function getOption($name);
+
+ /**
+ * 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
+ */
+ public function setOption($name, $value);
+
+ /**
+ * 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
+ */
+ public function hasOption($name);
+
+ /**
+ * Is this input means interactive?
+ *
+ * @return bool
+ */
+ public function isInteractive();
+
+ /**
+ * Sets the input interactivity.
+ *
+ * @param bool $interactive If the input should be interactive
+ */
+ public function setInteractive($interactive);
+}
diff --git a/vendor/symfony/console/Input/InputOption.php b/vendor/symfony/console/Input/InputOption.php
new file mode 100644
index 00000000..f08c5f26
--- /dev/null
+++ b/vendor/symfony/console/Input/InputOption.php
@@ -0,0 +1,212 @@
+<?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\Input;
+
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Exception\LogicException;
+
+/**
+ * Represents a command line option.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class InputOption
+{
+ const VALUE_NONE = 1;
+ const VALUE_REQUIRED = 2;
+ const VALUE_OPTIONAL = 4;
+ const VALUE_IS_ARRAY = 8;
+
+ private $name;
+ private $shortcut;
+ private $mode;
+ private $default;
+ private $description;
+
+ /**
+ * Constructor.
+ *
+ * @param string $name The option name
+ * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
+ * @param int $mode The option mode: One of the VALUE_* constants
+ * @param string $description A description text
+ * @param mixed $default The default value (must be null for self::VALUE_NONE)
+ *
+ * @throws InvalidArgumentException If option mode is invalid or incompatible
+ */
+ public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
+ {
+ if (0 === strpos($name, '--')) {
+ $name = substr($name, 2);
+ }
+
+ if (empty($name)) {
+ throw new InvalidArgumentException('An option name cannot be empty.');
+ }
+
+ if (empty($shortcut)) {
+ $shortcut = null;
+ }
+
+ if (null !== $shortcut) {
+ if (is_array($shortcut)) {
+ $shortcut = implode('|', $shortcut);
+ }
+ $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
+ $shortcuts = array_filter($shortcuts);
+ $shortcut = implode('|', $shortcuts);
+
+ if (empty($shortcut)) {
+ throw new InvalidArgumentException('An option shortcut cannot be empty.');
+ }
+ }
+
+ if (null === $mode) {
+ $mode = self::VALUE_NONE;
+ } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
+ throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
+ }
+
+ $this->name = $name;
+ $this->shortcut = $shortcut;
+ $this->mode = $mode;
+ $this->description = $description;
+
+ if ($this->isArray() && !$this->acceptValue()) {
+ throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
+ }
+
+ $this->setDefault($default);
+ }
+
+ /**
+ * Returns the option shortcut.
+ *
+ * @return string The shortcut
+ */
+ public function getShortcut()
+ {
+ return $this->shortcut;
+ }
+
+ /**
+ * Returns the option name.
+ *
+ * @return string The name
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Returns true if the option accepts a value.
+ *
+ * @return bool true if value mode is not self::VALUE_NONE, false otherwise
+ */
+ public function acceptValue()
+ {
+ return $this->isValueRequired() || $this->isValueOptional();
+ }
+
+ /**
+ * Returns true if the option requires a value.
+ *
+ * @return bool true if value mode is self::VALUE_REQUIRED, false otherwise
+ */
+ public function isValueRequired()
+ {
+ return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
+ }
+
+ /**
+ * Returns true if the option takes an optional value.
+ *
+ * @return bool true if value mode is self::VALUE_OPTIONAL, false otherwise
+ */
+ public function isValueOptional()
+ {
+ return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
+ }
+
+ /**
+ * Returns true if the option can take multiple values.
+ *
+ * @return bool true if mode is self::VALUE_IS_ARRAY, false otherwise
+ */
+ public function isArray()
+ {
+ return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
+ }
+
+ /**
+ * Sets the default value.
+ *
+ * @param mixed $default The default value
+ *
+ * @throws LogicException When incorrect default value is given
+ */
+ public function setDefault($default = null)
+ {
+ if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
+ throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
+ }
+
+ if ($this->isArray()) {
+ if (null === $default) {
+ $default = array();
+ } elseif (!is_array($default)) {
+ throw new LogicException('A default value for an array option must be an array.');
+ }
+ }
+
+ $this->default = $this->acceptValue() ? $default : false;
+ }
+
+ /**
+ * Returns the default value.
+ *
+ * @return mixed The default value
+ */
+ public function getDefault()
+ {
+ return $this->default;
+ }
+
+ /**
+ * Returns the description text.
+ *
+ * @return string The description text
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Checks whether the given option equals this one.
+ *
+ * @param InputOption $option option to compare
+ *
+ * @return bool
+ */
+ public function equals(InputOption $option)
+ {
+ return $option->getName() === $this->getName()
+ && $option->getShortcut() === $this->getShortcut()
+ && $option->getDefault() === $this->getDefault()
+ && $option->isArray() === $this->isArray()
+ && $option->isValueRequired() === $this->isValueRequired()
+ && $option->isValueOptional() === $this->isValueOptional()
+ ;
+ }
+}
diff --git a/vendor/symfony/console/Input/StringInput.php b/vendor/symfony/console/Input/StringInput.php
new file mode 100644
index 00000000..a40ddba3
--- /dev/null
+++ b/vendor/symfony/console/Input/StringInput.php
@@ -0,0 +1,85 @@
+<?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\Input;
+
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+
+/**
+ * StringInput represents an input provided as a string.
+ *
+ * Usage:
+ *
+ * $input = new StringInput('foo --bar="foobar"');
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class StringInput extends ArgvInput
+{
+ const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
+ const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
+
+ /**
+ * Constructor.
+ *
+ * @param string $input An array of parameters from the CLI (in the argv format)
+ * @param InputDefinition $definition A InputDefinition instance
+ *
+ * @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead
+ */
+ public function __construct($input, InputDefinition $definition = null)
+ {
+ if ($definition) {
+ @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
+ }
+
+ parent::__construct(array(), null);
+
+ $this->setTokens($this->tokenize($input));
+
+ if (null !== $definition) {
+ $this->bind($definition);
+ }
+ }
+
+ /**
+ * Tokenizes a string.
+ *
+ * @param string $input The input to tokenize
+ *
+ * @return array An array of tokens
+ *
+ * @throws InvalidArgumentException When unable to parse input (should never happen)
+ */
+ private function tokenize($input)
+ {
+ $tokens = array();
+ $length = strlen($input);
+ $cursor = 0;
+ while ($cursor < $length) {
+ if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
+ } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
+ $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
+ } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
+ $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
+ } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
+ $tokens[] = stripcslashes($match[1]);
+ } else {
+ // should never happen
+ throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
+ }
+
+ $cursor += strlen($match[0]);
+ }
+
+ return $tokens;
+ }
+}