Dispatcher
class Dispatcher implements Dispatcher, QueueingDispatcher, HandlerResolver (View source)
Properties
protected Container | $container | The container implementation. | |
protected Pipeline | $pipeline | The pipeline instance for the bus. | |
protected array | $pipes | The pipes to send commands through before dispatching. | |
protected Closure|null | $queueResolver | The queue resolver callback. | |
protected array | $mappings | All of the command-to-handler mappings. | |
protected Closure | $mapper | The fallback mapping Closure. |
Methods
void | __construct(Container $container, Closure $queueResolver = null) Create a new command dispatcher instance. | |
mixed | dispatchFromArray(mixed $command, array $array) Marshal a command and dispatch it to its appropriate handler. | |
mixed | dispatchFrom(mixed $command, ArrayAccess $source, array $extras = []) Marshal a command and dispatch it to its appropriate handler. | |
mixed | marshalFromArray(string $command, array $array) Marshal a command from the given array. | |
mixed | marshal(string $command, ArrayAccess $source, array $extras = []) Marshal a command from the given array accessible object. | |
mixed | getParameterValueForCommand(string $command, ArrayAccess $source, ReflectionParameter $parameter, array $extras = []) Get a parameter value for a marshalled command. | |
mixed | dispatch(mixed $command, Closure $afterResolving = null) Dispatch a command to its appropriate handler. | |
mixed | dispatchNow(mixed $command, Closure $afterResolving = null) Dispatch a command to its appropriate handler in the current process. | |
bool | commandShouldBeQueued(mixed $command) Determine if the given command should be queued. | |
mixed | dispatchToQueue(mixed $command) Dispatch a command to its appropriate handler behind a queue. | |
mixed | pushCommandToQueue(Queue $queue, mixed $command) Push the command onto the given queue instance. | |
mixed | resolveHandler(mixed $command) Get the handler instance for the given command. | |
string | getHandlerClass(mixed $command) Get the handler class for the given command. | |
string | getHandlerMethod(mixed $command) Get the handler method for the given command. | |
string | inflectSegment(mixed $command, int $segment) Get the given handler segment for the given command. | |
string | getMappingSegment(string $className, int $segment) Get the given segment from a given class handler. | |
string | getMapperSegment(mixed $command, int $segment) Get the given segment from a given class handler using the custom mapper. | |
void | maps(array $commands) Register command-to-handler mappings. | |
void | mapUsing(Closure $mapper) Register a fallback mapper callback. | |
static string | simpleMapping(mixed $command, string $commandNamespace, string $handlerNamespace) Map the command to a handler within a given root namespace. | |
$this | pipeThrough(array $pipes) Set the pipes through which commands should be piped before dispatching. |
Details
void __construct(Container $container, Closure $queueResolver = null)
Create a new command dispatcher instance.
mixed dispatchFromArray(mixed $command, array $array)
Marshal a command and dispatch it to its appropriate handler.
mixed dispatchFrom(mixed $command, ArrayAccess $source, array $extras = [])
Marshal a command and dispatch it to its appropriate handler.
protected mixed marshalFromArray(string $command, array $array)
Marshal a command from the given array.
protected mixed marshal(string $command, ArrayAccess $source, array $extras = [])
Marshal a command from the given array accessible object.
protected mixed getParameterValueForCommand(string $command, ArrayAccess $source, ReflectionParameter $parameter, array $extras = [])
Get a parameter value for a marshalled command.
mixed dispatch(mixed $command, Closure $afterResolving = null)
Dispatch a command to its appropriate handler.
mixed dispatchNow(mixed $command, Closure $afterResolving = null)
Dispatch a command to its appropriate handler in the current process.
protected bool commandShouldBeQueued(mixed $command)
Determine if the given command should be queued.
mixed dispatchToQueue(mixed $command)
Dispatch a command to its appropriate handler behind a queue.
protected mixed pushCommandToQueue(Queue $queue, mixed $command)
Push the command onto the given queue instance.
mixed resolveHandler(mixed $command)
Get the handler instance for the given command.
string getHandlerClass(mixed $command)
Get the handler class for the given command.
string getHandlerMethod(mixed $command)
Get the handler method for the given command.
protected string inflectSegment(mixed $command, int $segment)
Get the given handler segment for the given command.
protected string getMappingSegment(string $className, int $segment)
Get the given segment from a given class handler.
protected string getMapperSegment(mixed $command, int $segment)
Get the given segment from a given class handler using the custom mapper.
void maps(array $commands)
Register command-to-handler mappings.
void mapUsing(Closure $mapper)
Register a fallback mapper callback.
static string simpleMapping(mixed $command, string $commandNamespace, string $handlerNamespace)
Map the command to a handler within a given root namespace.
$this pipeThrough(array $pipes)
Set the pipes through which commands should be piped before dispatching.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.1/Illuminate/Bus/Dispatcher.html