Dispatcher
in package
implements
QueueingDispatcher
Interfaces, Classes and Traits
Table of Contents
- $container : Container
- The container implementation.
- $handlers : array<string|int, mixed>
- The command to handler mapping for non-self-handling events.
- $pipeline : Pipeline
- The pipeline instance for the bus.
- $pipes : array<string|int, mixed>
- The pipes to send commands through before dispatching.
- $queueResolver : Closure|null
- The queue resolver callback.
- __construct() : void
- Create a new command dispatcher instance.
- dispatch() : mixed
- Dispatch a command to its appropriate handler.
- dispatchNow() : mixed
- Dispatch a command to its appropriate handler in the current process.
- dispatchToQueue() : mixed
- Dispatch a command to its appropriate handler behind a queue.
- getCommandHandler() : bool|mixed
- Retrieve the handler for a command.
- hasCommandHandler() : bool
- Determine if the given command has a handler.
- map() : $this
- Map a command to a handler.
- pipeThrough() : $this
- Set the pipes through which commands should be piped before dispatching.
- commandShouldBeQueued() : bool
- Determine if the given command should be queued.
- pushCommandToQueue() : mixed
- Push the command onto the given queue instance.
Properties
$container
The container implementation.
protected
Container
$container
$handlers
The command to handler mapping for non-self-handling events.
protected
array<string|int, mixed>
$handlers
= []
$pipeline
The pipeline instance for the bus.
protected
Pipeline
$pipeline
$pipes
The pipes to send commands through before dispatching.
protected
array<string|int, mixed>
$pipes
= []
$queueResolver
The queue resolver callback.
protected
Closure|null
$queueResolver
Methods
__construct()
Create a new command dispatcher instance.
public
__construct(Container $container[, Closure|null $queueResolver = null ]) : void
Parameters
- $container : Container
- $queueResolver : Closure|null = null
Return values
void —dispatch()
Dispatch a command to its appropriate handler.
public
dispatch(mixed $command) : mixed
Parameters
- $command : mixed
Return values
mixed —dispatchNow()
Dispatch a command to its appropriate handler in the current process.
public
dispatchNow(mixed $command[, mixed $handler = null ]) : mixed
Parameters
- $command : mixed
- $handler : mixed = null
Return values
mixed —dispatchToQueue()
Dispatch a command to its appropriate handler behind a queue.
public
dispatchToQueue(mixed $command) : mixed
Parameters
- $command : mixed
Tags
Return values
mixed —getCommandHandler()
Retrieve the handler for a command.
public
getCommandHandler(mixed $command) : bool|mixed
Parameters
- $command : mixed
Return values
bool|mixed —hasCommandHandler()
Determine if the given command has a handler.
public
hasCommandHandler(mixed $command) : bool
Parameters
- $command : mixed
Return values
bool —map()
Map a command to a handler.
public
map(array<string|int, mixed> $map) : $this
Parameters
- $map : array<string|int, mixed>
Return values
$this —pipeThrough()
Set the pipes through which commands should be piped before dispatching.
public
pipeThrough(array<string|int, mixed> $pipes) : $this
Parameters
- $pipes : array<string|int, mixed>
Return values
$this —commandShouldBeQueued()
Determine if the given command should be queued.
protected
commandShouldBeQueued(mixed $command) : bool
Parameters
- $command : mixed
Return values
bool —pushCommandToQueue()
Push the command onto the given queue instance.
protected
pushCommandToQueue(Queue $queue, mixed $command) : mixed
Parameters
- $queue : Queue
- $command : mixed