class Dispatcher implements QueueingDispatcher

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 array $handlers

The command to handler mapping for non-self-handling events.

protected Closure|null $queueResolver

The queue resolver callback.

Methods

void
__construct(Container $container, Closure $queueResolver = null)

Create a new command dispatcher instance.

mixed
dispatch(mixed $command)

Dispatch a command to its appropriate handler.

mixed
dispatchNow(mixed $command, mixed $handler = null)

Dispatch a command to its appropriate handler in the current process.

bool
hasCommandHandler(mixed $command)

Determine if the given command has a handler.

bool|mixed
getCommandHandler(mixed $command)

Retrieve the handler for a command.

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.

$this
pipeThrough(array $pipes)

Set the pipes through which commands should be piped before dispatching.

$this
map(array $map)

Map a command to a handler.

Details

at line 57
void __construct(Container $container, Closure $queueResolver = null)

Create a new command dispatcher instance.

Parameters

Container $container
Closure $queueResolver

Return Value

void

at line 70
mixed dispatch(mixed $command)

Dispatch a command to its appropriate handler.

Parameters

mixed $command

Return Value

mixed

at line 86
mixed dispatchNow(mixed $command, mixed $handler = null)

Dispatch a command to its appropriate handler in the current process.

Parameters

mixed $command
mixed $handler

Return Value

mixed

at line 107
bool hasCommandHandler(mixed $command)

Determine if the given command has a handler.

Parameters

mixed $command

Return Value

bool

at line 118
bool|mixed getCommandHandler(mixed $command)

Retrieve the handler for a command.

Parameters

mixed $command

Return Value

bool|mixed

at line 133
protected bool commandShouldBeQueued(mixed $command)

Determine if the given command should be queued.

Parameters

mixed $command

Return Value

bool

at line 146
mixed dispatchToQueue(mixed $command)

Dispatch a command to its appropriate handler behind a queue.

Parameters

mixed $command

Return Value

mixed

Exceptions

RuntimeException

at line 170
protected mixed pushCommandToQueue(Queue $queue, mixed $command)

Push the command onto the given queue instance.

Parameters

Queue $queue
mixed $command

Return Value

mixed

at line 193
$this pipeThrough(array $pipes)

Set the pipes through which commands should be piped before dispatching.

Parameters

array $pipes

Return Value

$this

at line 206
$this map(array $map)

Map a command to a handler.

Parameters

array $map

Return Value

$this