Run CLI commands for the provided application.
$aliases
protected array
$app
protected $factory
protected $root
protected string
cake
. __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\Command
eventManager( 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\CommandRunner
Cake\Event\EventDispatcherInterface::eventManager()
getEventManager( )
Get the application's event manager or the global one.
Cake\Event\EventManagerInterface
getShell( 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\Command
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 compatibile inflections and aliases.
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 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\Event
getEventManager() |
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–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.CommandRunner.html