Methods summary
public
|
|
public
Webmozart\Console\Api\Args\Format\ArgsFormat
|
|
public
static
|
#
setCommandNames( array $commandNames )
Sets the command names of the built format.
Sets the command names of the built format.
Parameters
- $commandNames
- The command names.
Returns
static The current instance.
|
public
static
|
#
addCommandNames( array $commandNames )
Adds command names to the built format.
Adds command names to the built format.
Parameters
- $commandNames
- The command names to add.
Returns
static The current instance.
|
public
static
|
|
public
boolean
|
#
hasCommandNames( boolean $includeBase = true )
Returns whether the builder contains any command names.
Returns whether the builder contains any command names.
Parameters
- $includeBase
Whether to consider command names of the base
format.
Returns
boolean Returns true if the builder contains any command names and
false otherwise.
|
public
Webmozart\Console\Api\Args\Format\CommandName[]
|
#
getCommandNames( boolean $includeBase = true )
Returns all command names added to the builder.
Returns all command names added to the builder.
Parameters
- $includeBase
Whether to include command names of the base
format in the result.
Returns
|
public
static
|
#
setCommandOptions( array $commandOptions )
Sets the command options of the built format.
Sets the command options of the built format.
Any existing command options are removed when this method is called.
Parameters
- $commandOptions
The command options of the built
format.
Returns
static The current instance.
Throws
See
|
public
static
|
#
addCommandOptions( array $commandOptions )
Adds command options to the builder.
Adds command options to the builder.
The existing command options stored in the builder are preserved.
Parameters
- $commandOptions
- The command options to add.
Returns
static The current instance.
Throws
See
|
public
static
|
#
addCommandOption( Webmozart\Console\Api\Args\Format\CommandOption $commandOption )
Adds a command option to the builder.
Adds a command option to the builder.
The existing command options stored in the builder are preserved.
Parameters
- $commandOption
- The command option to add.
Returns
static The current instance.
Throws
See
|
public
boolean
|
#
hasCommandOption( string $name, boolean $includeBase = true )
Returns whether the builder contains a specific command option.
Returns whether the builder contains a specific command option.
You can either pass the long or the short name of the command option.
Parameters
- $name
- The long or short option name.
- $includeBase
Whether to include command options in the base
format in the search.
Returns
boolean Returns true if the command option with the given name
could be found and false otherwise.
|
public
boolean
|
#
hasCommandOptions( boolean $includeBase = true )
Returns whether the builder contains any command options.
Returns whether the builder contains any command options.
Parameters
- $includeBase
Whether to include command options in the base
format in the search.
Returns
boolean Returns true if the builder contains command options and
false otherwise.
|
public
Webmozart\Console\Api\Args\Format\CommandOption
|
#
getCommandOption( string $name, boolean $includeBase = true )
Returns a command option by its long or short name.
Returns a command option by its long or short name.
Parameters
- $name
- The long or short option name.
- $includeBase
Whether to include command options in the base
format in the search.
Returns
Throws
|
public
Webmozart\Console\Api\Args\Format\CommandOption[]
|
#
getCommandOptions( boolean $includeBase = true )
Returns all command options added to the builder.
Returns all command options added to the builder.
Parameters
- $includeBase
Whether to include command options of the base
format in the result.
Returns
|
public
static
|
#
setArguments( array $arguments )
Sets the arguments of the built format.
Sets the arguments of the built format.
Any existing arguments are removed when this method is called.
Parameters
- $arguments
- The arguments of the built format.
Returns
static The current instance.
Throws
See
|
public
static
|
#
addArguments( array $arguments )
Adds arguments at the end of the argument list.
Adds arguments at the end of the argument list.
The existing arguments stored in the builder are preserved.
Parameters
- $arguments
- The arguments to add.
Returns
static The current instance.
Throws
See
|
public
static
|
#
addArgument( Webmozart\Console\Api\Args\Format\Argument $argument )
Adds an argument at the end of the argument list.
Adds an argument at the end of the argument list.
The existing arguments stored in the builder are preserved.
You cannot add arguments after adding a multi-valued argument. If you do
so, this method throws an exception.
Adding required arguments after optional arguments is not supported.
Also in this case an exception is thrown.
Parameters
- $argument
- The argument to add.
Returns
static The current instance.
Throws
|
public
boolean
|
#
hasArgument( string|integer $name, boolean $includeBase = true )
Returns whether the builder contains a specific argument.
Returns whether the builder contains a specific argument.
You can either pass the name of the argument or the 0-based position of
the argument.
Parameters
- $name
The argument name or its 0-based position
in the argument list.
- $includeBase
Whether to include arguments in the base
format in the search.
Returns
boolean Returns true if the argument with the given name or
position could be found and false otherwise.
|
public
boolean
|
#
hasMultiValuedArgument( boolean $includeBase = true )
Returns whether the builder contains a multi-valued argument.
Returns whether the builder contains a multi-valued argument.
Parameters
- $includeBase
Whether to include arguments in the base format
in the search.
Returns
boolean Returns true if the builder contains a multi-valued
argument and false otherwise.
|
public
boolean
|
#
hasOptionalArgument( boolean $includeBase = true )
Returns whether the builder contains an optional argument.
Returns whether the builder contains an optional argument.
Parameters
- $includeBase
Whether to include arguments in the base format
in the search.
Returns
boolean Returns true if the builder contains an optional argument
and false otherwise.
|
public
boolean
|
#
hasRequiredArgument( boolean $includeBase = true )
Returns whether the builder contains a required argument.
Returns whether the builder contains a required argument.
Parameters
- $includeBase
Whether to include arguments in the base format
in the search.
Returns
boolean Returns true if the builder contains a required argument
and false otherwise.
|
public
boolean
|
#
hasArguments( boolean $includeBase = true )
Returns whether the builder contains any argument.
Returns whether the builder contains any argument.
Parameters
- $includeBase
Whether to include arguments in the base format
in the search.
Returns
boolean Returns true if the builder contains any argument and
false otherwise.
|
public
Webmozart\Console\Api\Args\Format\Argument
|
#
getArgument( string|integer $name, boolean $includeBase = true )
Returns an argument by its name or position.
Returns an argument by its name or position.
You can either pass the name of the argument or the 0-based position of
the argument.
Parameters
- $name
The argument name or its 0-based position
in the argument list.
- $includeBase
Whether to include arguments in the base
format in the search.
Returns
Throws
|
public
Webmozart\Console\Api\Args\Format\Argument[]
|
#
getArguments( boolean $includeBase = true )
Returns all arguments added to the builder.
Returns all arguments added to the builder.
Parameters
- $includeBase
Whether to include arguments of the base format
in the result.
Returns
|
public
static
|
#
setOptions( array $options )
Sets the options of the built format.
Sets the options of the built format.
Any existing options are removed when this method is called.
Parameters
- $options
- The options of the built format.
Returns
static The current instance.
Throws
See
|
public
static
|
#
addOptions( array $options )
Adds options at the end of the options list.
Adds options at the end of the options list.
The existing options stored in the builder are preserved.
Parameters
- $options
- The options to add.
Returns
static The current instance.
Throws
See
|
public
static
|
#
addOption( Webmozart\Console\Api\Args\Format\Option $option )
Adds an option at the end of the options list.
Adds an option at the end of the options list.
The existing options stored in the builder are preserved.
Parameters
- $option
- The option to add.
Returns
static The current instance.
Throws
See
|
public
boolean
|
#
hasOption( string $name, boolean $includeBase = true )
Returns whether the builder contains a specific option.
Returns whether the builder contains a specific option.
You can either pass the long or the short name of the option.
Parameters
- $name
- The long or short option name.
- $includeBase
Whether to include options in the base format
in the search.
Returns
boolean Returns true if the option with the given name could be
found and false otherwise.
|
public
boolean
|
#
hasOptions( boolean $includeBase = true )
Returns whether the builder contains any option.
Returns whether the builder contains any option.
Parameters
- $includeBase
Whether to include options in the base format
in the search.
Returns
boolean Returns true if the builder contains any option and
false otherwise.
|
public
Webmozart\Console\Api\Args\Format\Option
|
#
getOption( string $name, boolean $includeBase = true )
Returns an option by its long or short name.
Returns an option by its long or short name.
Parameters
- $name
- The long or short option name.
- $includeBase
Whether to include options in the base format
in the search.
Returns
Throws
|
public
Webmozart\Console\Api\Args\Format\Option[]
|
#
getOptions( boolean $includeBase = true )
Returns all options added to the builder.
Returns all options added to the builder.
Parameters
- $includeBase
Whether to include options of the base format
in the result.
Returns
|
public
Webmozart\Console\Api\Args\Format\ArgsFormat
|
#
getFormat( )
Builds a format with the arguments and options added to the builder.
Builds a format with the arguments and options added to the builder.
Returns
|