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())
No description
setDefinition(array $definition)
Sets the definition of the input.
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.
getOption(string $name)
Returns an InputOption by name.
bool
hasOption(string $name)
Returns true if an InputOption object exists by name.
getOptions()
Gets the array of InputOption objects.
bool
hasShortcut(string $name)
Returns true if an InputOption object exists by shortcut.
Details
__construct(array $definition = array())
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.
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.
Gets the array of InputArgument objects.
int
getArgumentCount()
Returns the number of InputArguments.
int
getArgumentRequiredCount()
Returns the number of required InputArguments.
array
getArgumentDefaults()
setOptions(InputOption[] $options = array())
Sets the InputOption objects.
addOptions(InputOption[] $options = array())
Adds an array of InputOption objects.
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).
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)