88 lines
3.3 KiB
YAML
88 lines
3.3 KiB
YAML
name: ArrayInput
|
|
class_comment: '# * ArrayInput represents an input provided as an array.
|
|
|
|
# *
|
|
|
|
# * Usage:
|
|
|
|
# *
|
|
|
|
# * $input = new ArrayInput([''command'' => ''foo:bar'', ''foo'' => ''bar'',
|
|
''--bar'' => ''foobar'']);
|
|
|
|
# *
|
|
|
|
# * @author Fabien Potencier <fabien@symfony.com>'
|
|
dependencies:
|
|
- name: InvalidArgumentException
|
|
type: class
|
|
source: Symfony\Component\Console\Exception\InvalidArgumentException
|
|
- name: InvalidOptionException
|
|
type: class
|
|
source: Symfony\Component\Console\Exception\InvalidOptionException
|
|
properties: []
|
|
methods:
|
|
- name: __toString
|
|
visibility: public
|
|
parameters: []
|
|
comment: "# * ArrayInput represents an input provided as an array.\n# *\n# * Usage:\n\
|
|
# *\n# * $input = new ArrayInput(['command' => 'foo:bar', 'foo' => 'bar',\
|
|
\ '--bar' => 'foobar']);\n# *\n# * @author Fabien Potencier <fabien@symfony.com>\n\
|
|
# */\n# class ArrayInput extends Input\n# {\n# public function __construct(\n\
|
|
# private array $parameters,\n# ?InputDefinition $definition = null,\n# ) {\n\
|
|
# parent::__construct($definition);\n# }\n# \n# public function getFirstArgument():\
|
|
\ ?string\n# {\n# foreach ($this->parameters as $param => $value) {\n# if ($param\
|
|
\ && \\is_string($param) && '-' === $param[0]) {\n# continue;\n# }\n# \n# return\
|
|
\ $value;\n# }\n# \n# return null;\n# }\n# \n# public function hasParameterOption(string|array\
|
|
\ $values, bool $onlyParams = false): bool\n# {\n# $values = (array) $values;\n\
|
|
# \n# foreach ($this->parameters as $k => $v) {\n# if (!\\is_int($k)) {\n# $v\
|
|
\ = $k;\n# }\n# \n# if ($onlyParams && '--' === $v) {\n# return false;\n# }\n\
|
|
# \n# if (\\in_array($v, $values)) {\n# return true;\n# }\n# }\n# \n# return false;\n\
|
|
# }\n# \n# public function getParameterOption(string|array $values, string|bool|int|float|array|null\
|
|
\ $default = false, bool $onlyParams = false): mixed\n# {\n# $values = (array)\
|
|
\ $values;\n# \n# foreach ($this->parameters as $k => $v) {\n# if ($onlyParams\
|
|
\ && ('--' === $k || (\\is_int($k) && '--' === $v))) {\n# return $default;\n#\
|
|
\ }\n# \n# if (\\is_int($k)) {\n# if (\\in_array($v, $values)) {\n# return true;\n\
|
|
# }\n# } elseif (\\in_array($k, $values)) {\n# return $v;\n# }\n# }\n# \n# return\
|
|
\ $default;\n# }\n# \n# /**\n# * Returns a stringified representation of the args\
|
|
\ passed to the command."
|
|
- name: parse
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: addShortOption
|
|
visibility: private
|
|
parameters:
|
|
- name: shortcut
|
|
- name: value
|
|
comment: '# * Adds a short option value.
|
|
|
|
# *
|
|
|
|
# * @throws InvalidOptionException When option given doesn''t exist'
|
|
- name: addLongOption
|
|
visibility: private
|
|
parameters:
|
|
- name: name
|
|
- name: value
|
|
comment: '# * Adds a long option value.
|
|
|
|
# *
|
|
|
|
# * @throws InvalidOptionException When option given doesn''t exist
|
|
|
|
# * @throws InvalidOptionException When a required value is missing'
|
|
- name: addArgument
|
|
visibility: private
|
|
parameters:
|
|
- name: name
|
|
- name: value
|
|
comment: '# * Adds an argument value.
|
|
|
|
# *
|
|
|
|
# * @throws InvalidArgumentException When argument given doesn''t exist'
|
|
traits:
|
|
- Symfony\Component\Console\Exception\InvalidArgumentException
|
|
- Symfony\Component\Console\Exception\InvalidOptionException
|
|
interfaces: []
|