Class DelegatingHandler
Delegates command handling to one of a list of registered handlers.
You can register handlers or factory callbacks that create those handlers
with the Webmozart\Console\Handler\DelegatingHandler::register()
method:
$handler = new DelegatingHandler(); $handler->register('json', new JsonHandler()); $handler->register('xml', function () { $handler = new XmlHandler(); // ... return $handler; });
The executed handler can be selected with Webmozart\Console\Handler\DelegatingHandler::selectHandler()
. You need
to pass the name of the handler or a callback that receives the command,
the console arguments and the I/O as parameters:
$handler->selectHandler(function (Command $command, Args $args, IO $io) { return $args->getOption('format'); });
Run Webmozart\Console\Handler\DelegatingHandler::handle()
to execute the selected handler:
$handler->handle($command, $args, $io);
Direct known subclasses
Webmozart\Console\Handler\Help\HelpHandler
Namespace: Webmozart\Console\Handler
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Handler/DelegatingHandler.php
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Handler/DelegatingHandler.php
public
|
#
handle(
|
public
|
|
public
|
|
public
string[]
|
|
public
|