Methods summary
public
|
#
__construct( array $commands = array() )
Creates a new command collection.
Creates a new command collection.
Parameters
- $commands
The commands to initially add to the
collection.
|
public
|
#
add( Webmozart\Console\Api\Command\Command $command )
Adds a command to the collection.
Adds a command to the collection.
If a command exists with the same name in the collection, that command
is overwritten.
Parameters
- $command
- The command to add.
See
|
public
|
#
merge( array $commands )
Adds multiple commands to the collection.
Adds multiple commands to the collection.
Existing commands are preserved. Commands with the same names as the
passed commands are overwritten.
Parameters
- $commands
- The commands to add.
See
|
public
|
#
replace( array $commands )
Sets the commands in the collection.
Sets the commands in the collection.
Existing commands are replaced.
Parameters
- $commands
- The commands to set.
See
|
public
Webmozart\Console\Api\Command\Command
|
#
get( string $name )
Returns a command by its name.
Returns a command by its name.
Parameters
- $name
- The name of the command.
Returns
Throws
|
public
|
#
remove( string $name )
Removes the command with the given name from the collection.
Removes the command with the given name from the collection.
If no such command can be found, the method does nothing.
Parameters
- $name
- The name of the command.
|
public
boolean
|
#
contains( string $name )
Returns whether the collection contains a command with the given name.
Returns whether the collection contains a command with the given name.
Parameters
- $name
- The name of the command.
Returns
boolean Returns true if the collection contains a command with
that name and false otherwise.
|
public
|
#
clear( )
Removes all commands from the collection.
Removes all commands from the collection.
|
public
boolean
|
#
isEmpty( )
Returns whether the collection is empty.
Returns whether the collection is empty.
Returns
boolean Returns true if the collection is empty and false
otherwise.
|
public
Webmozart\Console\Api\Command\Command[]
|
#
toArray( )
Returns the contents of the collection as array.
Returns the contents of the collection as array.
The commands in the collection are returned indexed by their names. The
result is sorted in the order in which the commands were added to the
collection.
Returns
|
public
|
|
public
|
|
public
|
|
public
|
|
public
string[]
|
#
getNames( boolean $includeAliases = false )
Returns the names of all commands in the collection.
Returns the names of all commands in the collection.
The names are sorted alphabetically in ascending order. If you set
$includeAliases to true , the alias names are included in the result.
Parameters
- $includeAliases
- Whether to include alias names in the result.
Returns
string[] The sorted command names.
|
public
string[]
|
#
getAliases( )
Returns the aliases of all commands in the collection.
Returns the aliases of all commands in the collection.
The aliases are sorted alphabetically in ascending order.
Returns
string[] The command names indexed and sorted by their aliases.
|
public
|
#
offsetExists( $name )
Implementation of
ArrayAccess::offsetExists()
|
public
|
#
offsetGet( $name )
Implementation of
ArrayAccess::offsetGet()
|
public
|
#
offsetSet( $offset, $command )
Implementation of
ArrayAccess::offsetSet()
|
public
|
#
offsetUnset( $name )
Implementation of
ArrayAccess::offsetUnset()
|
public
|
#
getIterator( )
Implementation of
IteratorAggregate::getIterator()
|
public
|
#
count( )
Implementation of
Countable::count()
|