Skip to content

NativeCommandHandlerResolver


Properties

handlers

protected \Codefy\CommandBus\CommandHandler[] $handlers

container

protected \Codefy\CommandBus\Container $container

Methods

__construct

public __construct(\Codefy\CommandBus\Container $container = new \Codefy\CommandBus\Containers\NativeContainer()): mixed

Parameters:

Parameter Type Description
$container \Codefy\CommandBus\Container

resolve

Retrieve a CommandHandler for a given Command

public resolve(\Codefy\CommandBus\Command $command): \Codefy\CommandBus\CommandHandler

Parameters:

Parameter Type Description
$command \Codefy\CommandBus\Command

Throws:


bindHandler

Bind a handler to a command. These bindings should overrule the default resolution behavior for this resolver

public bindHandler(string $commandName, callable|\Codefy\CommandBus\CommandHandler|class-string $handler): void

Parameters:

Parameter Type Description
$commandName string
$handler callable|\Codefy\CommandBus\CommandHandler|class-string

Throws: