PHP Class Illuminate\Bus\Dispatcher

Inheritance: implements Illuminate\Contracts\Bus\Dispatcher, implements Illuminate\Contracts\Bus\QueueingDispatcher, implements Illuminate\Contracts\Bus\HandlerResolver
ファイルを表示 Open project: ctrlaltdylan/MirrorMirror Class Usage Examples

Protected Properties

Property Type Description
$container Illuminate\Contracts\Container\Container The container implementation.
$mapper Closure The fallback mapping Closure.
$mappings array All of the command-to-handler mappings.
$pipeline Illuminate\Pipeline\Pipeline The pipeline instance for the bus.
$pipes array The pipes to send commands through before dispatching.
$queueResolver Closure | null The queue resolver callback.

Public Methods

Method Description
__construct ( Illuminate\Contracts\Container\Container $container, Closure $queueResolver = null ) : void Create a new command dispatcher instance.
dispatch ( mixed $command, Closure $afterResolving = null ) : mixed Dispatch a command to its appropriate handler.
dispatchFrom ( mixed $command, ArrayAccess $source, array $extras = [] ) : mixed Marshal a command and dispatch it to its appropriate handler.
dispatchFromArray ( mixed $command, array $array ) : mixed Marshal a command and dispatch it to its appropriate handler.
dispatchNow ( mixed $command, Closure $afterResolving = null ) : mixed Dispatch a command to its appropriate handler in the current process.
dispatchToQueue ( mixed $command ) : mixed Dispatch a command to its appropriate handler behind a queue.
getHandlerClass ( mixed $command ) : string Get the handler class for the given command.
getHandlerMethod ( mixed $command ) : string Get the handler method for the given command.
mapUsing ( Closure $mapper ) : void Register a fallback mapper callback.
maps ( array $commands ) : void Register command-to-handler mappings.
pipeThrough ( array $pipes ) Set the pipes through which commands should be piped before dispatching.
resolveHandler ( mixed $command ) : mixed Get the handler instance for the given command.
simpleMapping ( mixed $command, string $commandNamespace, string $handlerNamespace ) : string Map the command to a handler within a given root namespace.

Protected Methods

Method Description
commandShouldBeQueued ( mixed $command ) : boolean Determine if the given command should be queued.
getMapperSegment ( mixed $command, integer $segment ) : string Get the given segment from a given class handler using the custom mapper.
getMappingSegment ( string $className, integer $segment ) : string Get the given segment from a given class handler.
getParameterValueForCommand ( string $command, ArrayAccess $source, ReflectionParameter $parameter, array $extras = [] ) : mixed Get a parameter value for a marshaled command.
inflectSegment ( mixed $command, integer $segment ) : string Get the given handler segment for the given command.
marshal ( string $command, ArrayAccess $source, array $extras = [] ) : mixed Marshal a command from the given array accessible object.
marshalFromArray ( string $command, array $array ) : mixed Marshal a command from the given array.
pushCommandToQueue ( Illuminate\Contracts\Queue\Queue $queue, mixed $command ) : mixed Push the command onto the given queue instance.

Method Details

__construct() public method

Create a new command dispatcher instance.
public __construct ( Illuminate\Contracts\Container\Container $container, Closure $queueResolver = null ) : void
$container Illuminate\Contracts\Container\Container
$queueResolver Closure
return void

commandShouldBeQueued() protected method

Determine if the given command should be queued.
protected commandShouldBeQueued ( mixed $command ) : boolean
$command mixed
return boolean

dispatch() public method

Dispatch a command to its appropriate handler.
public dispatch ( mixed $command, Closure $afterResolving = null ) : mixed
$command mixed
$afterResolving Closure
return mixed

dispatchFrom() public method

Marshal a command and dispatch it to its appropriate handler.
public dispatchFrom ( mixed $command, ArrayAccess $source, array $extras = [] ) : mixed
$command mixed
$source ArrayAccess
$extras array
return mixed

dispatchFromArray() public method

Marshal a command and dispatch it to its appropriate handler.
public dispatchFromArray ( mixed $command, array $array ) : mixed
$command mixed
$array array
return mixed

dispatchNow() public method

Dispatch a command to its appropriate handler in the current process.
public dispatchNow ( mixed $command, Closure $afterResolving = null ) : mixed
$command mixed
$afterResolving Closure
return mixed

dispatchToQueue() public method

Dispatch a command to its appropriate handler behind a queue.
public dispatchToQueue ( mixed $command ) : mixed
$command mixed
return mixed

getHandlerClass() public method

Get the handler class for the given command.
public getHandlerClass ( mixed $command ) : string
$command mixed
return string

getHandlerMethod() public method

Get the handler method for the given command.
public getHandlerMethod ( mixed $command ) : string
$command mixed
return string

getMapperSegment() protected method

Get the given segment from a given class handler using the custom mapper.
protected getMapperSegment ( mixed $command, integer $segment ) : string
$command mixed
$segment integer
return string

getMappingSegment() protected method

Get the given segment from a given class handler.
protected getMappingSegment ( string $className, integer $segment ) : string
$className string
$segment integer
return string

getParameterValueForCommand() protected method

Get a parameter value for a marshaled command.
protected getParameterValueForCommand ( string $command, ArrayAccess $source, ReflectionParameter $parameter, array $extras = [] ) : mixed
$command string
$source ArrayAccess
$parameter ReflectionParameter
$extras array
return mixed

inflectSegment() protected method

Get the given handler segment for the given command.
protected inflectSegment ( mixed $command, integer $segment ) : string
$command mixed
$segment integer
return string

mapUsing() public method

Register a fallback mapper callback.
public mapUsing ( Closure $mapper ) : void
$mapper Closure
return void

maps() public method

Register command-to-handler mappings.
public maps ( array $commands ) : void
$commands array
return void

marshal() protected method

Marshal a command from the given array accessible object.
protected marshal ( string $command, ArrayAccess $source, array $extras = [] ) : mixed
$command string
$source ArrayAccess
$extras array
return mixed

marshalFromArray() protected method

Marshal a command from the given array.
protected marshalFromArray ( string $command, array $array ) : mixed
$command string
$array array
return mixed

pipeThrough() public method

Set the pipes through which commands should be piped before dispatching.
public pipeThrough ( array $pipes )
$pipes array

pushCommandToQueue() protected method

Push the command onto the given queue instance.
protected pushCommandToQueue ( Illuminate\Contracts\Queue\Queue $queue, mixed $command ) : mixed
$queue Illuminate\Contracts\Queue\Queue
$command mixed
return mixed

resolveHandler() public method

Get the handler instance for the given command.
public resolveHandler ( mixed $command ) : mixed
$command mixed
return mixed

simpleMapping() public static method

Map the command to a handler within a given root namespace.
public static simpleMapping ( mixed $command, string $commandNamespace, string $handlerNamespace ) : string
$command mixed
$commandNamespace string
$handlerNamespace string
return string

Property Details

$container protected_oe property

The container implementation.
protected Container,Illuminate\Contracts\Container $container
return Illuminate\Contracts\Container\Container

$mapper protected_oe property

The fallback mapping Closure.
protected Closure $mapper
return Closure

$mappings protected_oe property

All of the command-to-handler mappings.
protected array $mappings
return array

$pipeline protected_oe property

The pipeline instance for the bus.
protected Pipeline,Illuminate\Pipeline $pipeline
return Illuminate\Pipeline\Pipeline

$pipes protected_oe property

The pipes to send commands through before dispatching.
protected array $pipes
return array

$queueResolver protected_oe property

The queue resolver callback.
protected Closure|null $queueResolver
return Closure | null