A InputDefinition represents a set of valid command line arguments and options.
Usage:
$definition = new InputDefinition([ new InputArgument('name', InputArgument::REQUIRED), new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), ]);
- author Fabien Potencier
Methods |
public __construct(array $definition = [])
|
public addArgument(Symfony
|
public addArguments(?array $arguments = []) : void Adds an array of InputArgument objects.
|
public addOption(Symfony
|
public addOptions(array $options = []) : void Adds an array of InputOption objects.
|
public getArgument(string|int $name) : Symfony Returns an InputArgument by name or by position.
|
public getArgumentCount() : int Returns the number of InputArguments. |
public getArgumentDefaults() : array
|
public getArgumentRequiredCount() : int Returns the number of required InputArguments. |
public getArguments() : array Gets the array of InputArgument objects.
|
public getOption(string $name) : Symfony Returns an InputOption by name.
|
public getOptionDefaults() : array
|
public getOptionForShortcut(string $shortcut) : Symfony Gets an InputOption by shortcut. |
public getOptions() : array Gets the array of InputOption objects.
|
public getSynopsis(bool $short = false) : string Gets the synopsis. |
public hasArgument(string|int $name) : bool Returns true if an InputArgument object exists by name or position. |
public hasNegation(string $name) : bool Returns true if an InputOption object exists by negated name. |
public hasOption(string $name) : bool 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). |
public hasShortcut(string $name) : bool Returns true if an InputOption object exists by shortcut. |
public negationToName(string $negation) : string Returns the InputOption name given a negation.
|
public setArguments(array $arguments = []) : void Sets the InputArgument objects.
|
public setDefinition(array $definition) : void Sets the definition of the input. |
public setOptions(array $options = []) : void Sets the InputOption objects.
|
public shortcutToName(string $shortcut) : string Returns the InputOption name given a shortcut.
|
Properties |
private array $arguments = [] |
private ?Symfony |
private ?Symfony |
private array $negations = [] |
private array $options = [] |
private int $requiredCount = 0 |
private array $shortcuts = [] |