InputDefinition
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
Constructor.
Sets the definition of the input.
Returns an InputArgument by name or by position.
Returns true if an InputArgument object exists by name or position.
Gets the array of InputArgument objects.
Returns the number of InputArguments.
Returns the number of required InputArguments.
Gets the default values.
Returns an InputOption by name.
Returns true if an InputOption object exists by name.
Gets the array of InputOption objects.
Returns true if an InputOption object exists by shortcut.
Gets an InputOption by shortcut.
Gets an array of default values.
Gets the synopsis.
Details
at line line 43
__construct(array $definition = array())
Constructor.
at line line 53
setDefinition(array $definition)
Sets the definition of the input.
at line line 74
setArguments(InputArgument[] $arguments = array())
Sets the InputArgument objects.
at line line 88
addArguments(InputArgument[] $arguments = array())
Adds an array of InputArgument objects.
at line line 104
addArgument(InputArgument $argument)
Adds an InputArgument object.
at line line 140
InputArgument
getArgument(string|int $name)
Returns an InputArgument by name or by position.
at line line 158
bool
hasArgument(string|int $name)
Returns true if an InputArgument object exists by name or position.
at line line 170
InputArgument[]
getArguments()
Gets the array of InputArgument objects.
at line line 180
int
getArgumentCount()
Returns the number of InputArguments.
at line line 190
int
getArgumentRequiredCount()
Returns the number of required InputArguments.
at line line 200
array
getArgumentDefaults()
Gets the default values.
at line line 215
setOptions(InputOption[] $options = array())
Sets the InputOption objects.
at line line 227
addOptions(InputOption[] $options = array())
Adds an array of InputOption objects.
at line line 241
addOption(InputOption $option)
Adds an InputOption object.
at line line 272
InputOption
getOption(string $name)
Returns an InputOption by name.
at line line 288
bool
hasOption(string $name)
Returns true if an InputOption object exists by name.
at line line 298
InputOption[]
getOptions()
Gets the array of InputOption objects.
at line line 310
bool
hasShortcut(string $name)
Returns true if an InputOption object exists by shortcut.
at line line 322
InputOption
getOptionForShortcut(string $shortcut)
Gets an InputOption by shortcut.
at line line 332
array
getOptionDefaults()
Gets an array of default values.
at line line 367
string
getSynopsis(bool $short = false)
Gets the synopsis.