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 summary
public
|
#
__construct( array $definition = array() )
Constructor.
Parameters
- $definition
- An array of InputArgument and InputOption instance
|
public
|
#
setDefinition( array $definition )
Sets the definition of the input.
Sets the definition of the input.
Parameters
- $definition
- The definition array
|
public
|
|
public
|
|
public
|
|
public
Symfony\Component\Console\Input\InputArgument
|
#
getArgument( string|integer $name )
Returns an InputArgument by name or by position.
Returns an InputArgument by name or by position.
Parameters
- $name
- The InputArgument name or position
Returns
Throws
|
public
boolean
|
#
hasArgument( string|integer $name )
Returns true if an InputArgument object exists by name or position.
Returns true if an InputArgument object exists by name or position.
Parameters
- $name
- The InputArgument name or position
Returns
boolean true if the InputArgument object exists, false otherwise
|
public
Symfony\Component\Console\Input\InputArgument[]
|
#
getArguments( )
Gets the array of InputArgument objects.
Gets the array of InputArgument objects.
Returns
|
public
integer
|
#
getArgumentCount( )
Returns the number of InputArguments.
Returns the number of InputArguments.
Returns
integer The number of InputArguments
|
public
integer
|
#
getArgumentRequiredCount( )
Returns the number of required InputArguments.
Returns the number of required InputArguments.
Returns
integer The number of required InputArguments
|
public
array
|
|
public
|
|
public
|
|
public
|
|
public
Symfony\Component\Console\Input\InputOption
|
#
getOption( string $name )
Returns an InputOption by name.
Returns an InputOption by name.
Parameters
- $name
- The InputOption name
Returns
Throws
|
public
boolean
|
#
hasOption( string $name )
Returns true if an InputOption object exists by 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).
Parameters
- $name
- The InputOption name
Returns
boolean true if the InputOption object exists, false otherwise
|
public
Symfony\Component\Console\Input\InputOption[]
|
#
getOptions( )
Gets the array of InputOption objects.
Gets the array of InputOption objects.
Returns
|
public
boolean
|
#
hasShortcut( string $name )
Returns true if an InputOption object exists by shortcut.
Returns true if an InputOption object exists by shortcut.
Parameters
- $name
- The InputOption shortcut
Returns
boolean true if the InputOption object exists, false otherwise
|
public
Symfony\Component\Console\Input\InputOption
|
#
getOptionForShortcut( string $shortcut )
Gets an InputOption by shortcut.
Gets an InputOption by shortcut.
Parameters
- $shortcut
- the Shortcut name
Returns
|
public
array
|
#
getOptionDefaults( )
Gets an array of default values.
Gets an array of default values.
Returns
array An array of all default values
|
public
string
|
#
getSynopsis( boolean $short = false )
Gets the synopsis.
Parameters
- $short
- Whether to return the short version (with options folded) or not
Returns
string The synopsis
|
public
string
|
#
asText( )
Returns a textual representation of the InputDefinition.
Returns a textual representation of the InputDefinition.
Deprecated
since version 2.3, to be removed in 3.0.
Returns
string A string representing the InputDefinition
|
public
string|DOMDocument
|
#
asXml( boolean $asDom = false )
Returns an XML representation of the InputDefinition.
Returns an XML representation of the InputDefinition.
Deprecated
since version 2.3, to be removed in 3.0.
Parameters
- $asDom
- Whether to return a DOM or an XML string
Returns
string|DOMDocument An XML string representing the InputDefinition
|