Run CLI commands for the provided application.
$aliases protected array$app protected $factory protected $root protected stringcake. __construct( Cake\Core\ConsoleApplicationInterface $app , string $root = 'cake' , Cake\Console\CommandFactoryInterface $factory = null )
Constructor
Cake\Core\ConsoleApplicationInterface $app $root optional 'cake' Cake\Console\CommandFactoryInterface $factory optional null bootstrap( )
Application bootstrap wrapper.
Calls bootstrap() and events() if application implements EventApplicationInterface. After the application is bootstrapped and events are attached, plugins are bootstrapped and have their events attached.
checkCollection( mixed $commands , string $method )
Check the created CommandCollection
$commands $method createShell( string $className , Cake\Console\ConsoleIo $io )
The wrapper for creating shell instances.
$className Cake\Console\ConsoleIo $io Cake\Console\Shell|Cake\Console\CommandeventManager( Cake\Event\EventManager $events = null )
Get/set the application's event manager.
If the application does not support events and this method is used as a setter, an exception will be raised.
Cake\Event\EventManager $events optional null Cake\Event\EventManager|Cake\Console\CommandRunnerCake\Event\EventDispatcherInterface::eventManager() getEventManager( )
Get the application's event manager or the global one.
Cake\Event\EventManagerInterfacegetShell( Cake\Console\ConsoleIo $io , Cake\Console\CommandCollection $commands , string $name )
Get the shell instance for a given command name
Cake\Console\ConsoleIo $io Cake\Console\CommandCollection $commands $name Cake\Console\Shell|Cake\Console\CommandloadRoutes( )
Ensure that the application's routes are loaded.
Console commands and shells often need to generate URLs.
longestCommandName( Cake\Console\CommandCollection $commands , array $argv )
Build the longest command name that exists in the collection
Build the longest command name that matches a defined command. This will traverse a maximum of 3 tokens.
Cake\Console\CommandCollection $commands $argv resolveName( Cake\Console\CommandCollection $commands , Cake\Console\ConsoleIo $io , string $name )
Resolve the command name into a name that exists in the collection.
Apply backwards compatible inflections and aliases. Will step forward up to 3 tokens in $argv to generate a command name in the CommandCollection. More specific command names take precedence over less specific ones.
Cake\Console\CommandCollection $commands Cake\Console\ConsoleIo $io $name run( array $argv , Cake\Console\ConsoleIo $io = null )
Run the command contained in $argv.
Use the application to do the following:
Console.buildCommands event of auto-wiring plugins.$argv Cake\Console\ConsoleIo $io optional null runCommand( Cake\Console\Command $command , array $argv , Cake\Console\ConsoleIo $io )
Execute a Command class.
Cake\Console\Command $command $argv Cake\Console\ConsoleIo $io runShell( Cake\Console\Shell $shell , array $argv )
Execute a Shell class.
Cake\Console\Shell $shell $argv setAliases( array $aliases )
Replace the entire alias map for a runner.
Aliases allow you to define alternate names for commands in the collection. This can be useful to add top level switches like --version or -h
$runner->setAliases(['--version' => 'version']);
$aliases setEventManager( Cake\Event\EventManager $events )
Get/set the application's event manager.
If the application does not support events and this method is used as a setter, an exception will be raised.
Cake\Event\EventManager $events dispatchEvent( string $name , array|null $data = null , object|null $subject = null )
Wrapper for creating and dispatching events.
Returns a dispatched event.
$name $data optional null Any value you wish to be transported with this event to it can be read by listeners.
$subject optional null The object that this event applies to ($this by default).
Cake\Event\EventgetEventManager() |
protected Cake\Core\ConsoleApplicationInterface
The application console commands are being run for.
protected Cake\Console\CommandFactoryInterface
The application console commands are being run for.
© 2005–present 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.8/class-Cake.Console.CommandRunner.html