class InputDefinition
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),
));
Methods
__construct(array $definition = array()) Constructor. | ||
setDefinition(array $definition) Sets the definition of the input. | ||
setArguments(InputArgument[] $arguments = array()) Sets the InputArgument objects. | ||
addArguments(InputArgument[] $arguments = array()) Adds an array of InputArgument objects. | ||
addArgument(InputArgument $argument) Adds an InputArgument object. | ||
InputArgument | getArgument(string|int $name) Returns an InputArgument by name or by position. | |
bool | hasArgument(string|int $name) Returns true if an InputArgument object exists by name or position. | |
InputArgument[] | getArguments() Gets the array of InputArgument objects. | |
int | getArgumentCount() Returns the number of InputArguments. | |
int | getArgumentRequiredCount() Returns the number of required InputArguments. | |
array | getArgumentDefaults() Gets the default values. | |
setOptions(InputOption[] $options = array()) Sets the InputOption objects. | ||
addOptions(InputOption[] $options = array()) Adds an array of InputOption objects. | ||
addOption(InputOption $option) Adds an InputOption object. | ||
InputOption | getOption(string $name) Returns an InputOption by name. | |
bool | hasOption(string $name) Returns true if an InputOption object exists by name. | |
InputOption[] | getOptions() Gets the array of InputOption objects. | |
bool | hasShortcut(string $name) Returns true if an InputOption object exists by shortcut. | |
InputOption | getOptionForShortcut(string $shortcut) Gets an InputOption by shortcut. | |
array | getOptionDefaults() Gets an array of default values. | |
string | getSynopsis(bool $short = false) Gets the synopsis. |
Details
__construct(array $definition = array())
Constructor.
setDefinition(array $definition)
Sets the definition of the input.
setArguments(InputArgument[] $arguments = array())
Sets the InputArgument objects.
addArguments(InputArgument[] $arguments = array())
Adds an array of InputArgument objects.
addArgument(InputArgument $argument)
Adds an InputArgument object.
InputArgument getArgument(string|int $name)
Returns an InputArgument by name or by position.
bool hasArgument(string|int $name)
Returns true if an InputArgument object exists by name or position.
InputArgument[] getArguments()
Gets the array of InputArgument objects.
int getArgumentCount()
Returns the number of InputArguments.
int getArgumentRequiredCount()
Returns the number of required InputArguments.
array getArgumentDefaults()
Gets the default values.
setOptions(InputOption[] $options = array())
Sets the InputOption objects.
addOptions(InputOption[] $options = array())
Adds an array of InputOption objects.
addOption(InputOption $option)
Adds an InputOption object.
InputOption getOption(string $name)
Returns an InputOption by name.
bool hasOption(string $name)
Returns true if an InputOption object exists by name.
This method can't be used to check if the user included the option when executing the command (use getOption() instead).
InputOption[] getOptions()
Gets the array of InputOption objects.
bool hasShortcut(string $name)
Returns true if an InputOption object exists by shortcut.
InputOption getOptionForShortcut(string $shortcut)
Gets an InputOption by shortcut.
array getOptionDefaults()
Gets an array of default values.
string getSynopsis(bool $short = false)
Gets the synopsis.
Please login to continue.