Collection for Commands.
Used by Applications to whitelist their console commands. CakePHP will use the mapped commands to construct and dispatch shell commands.
$commands
protected array
__construct( array $commands [] )
Constructor
$commands
optional [] add( string $name , string|Cake\Console\Shell|Cake\Console\Command $command )
Add a command to the collection
$name
Cake\Console\Shell
|Cake\Console\Command
$command
addMany( array $commands )
Add multiple commands at once.
$commands
autoDiscover( )
Automatically discover shell commands in CakePHP, the application and all plugins.
Commands will be located using filesystem conventions. Commands are discovered in the following order:
Commands defined in the application will ovewrite commands with the same name provided by CakePHP.
count( )
Implementation of Countable.
Get the number of commands in the collection.
Countable::count()
discoverPlugin( string $plugin )
Auto-discover shell & commands from the named plugin.
Discovered commands will have their names de-duplicated with existing commands in the collection. If a command is already defined in the collection and discovered in a plugin, only the long name (plugin.command
) will be returned.
$plugin
get( string $name )
Get the target for a command.
$name
Cake\Console\Shell
getIterator( )
Implementation of IteratorAggregate.
IteratorAggregate::getIterator()
has( string $name )
Check whether the named shell exists in the collection.
$name
remove( string $name )
Remove a command from the collection if it exists.
$name
resolveNames( array $input )
Resolve names based on existing commands
$input
© 2005–2018 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.6/class-Cake.Console.CommandCollection.html