src/Dispatcher/CommandDispatcher.php
protected function getCommandHandler(CommandMessageInterface $commandMessage): CommandHandlerInterface
    {
        $name = $commandMessage->getPayloadType()->getName();
        $commandHandlers = $this->getCommandHandlers();
        if (array_key_exists($name, $commandHandlers) === false) {
            throw new CommandHandlerNotFound($commandMessage);
        }

        return $commandHandlers[$name];
    }
protected function getCommandHandler(CommandMessageInterface $commandMessage): CommandHandlerInterface
    {
        $name = $commandMessage->getPayloadType()->getName();
        $commandHandlers = $this->getCommandHandlers();
        if (array_key_exists($name, $commandHandlers) === false) {
            throw new CommandHandlerNotFound($commandMessage);
        }

        return $commandHandlers[$name];
    }
protected function getCommandHandler ( CommandMessageInterface $ commandMessage ) : CommandHandlerInterface { $ name = $ commandMessage -> getPayloadType ( ) -> getName ( ) ; $ commandHandlers = $ this -> getCommandHandlers ( ) ; if ( array_key_exists ( $ name , $ commandHandlers ) === false ) { throw new CommandHandlerNotFound ( $ commandMessage ) ; } return $ commandHandlers [ $ name ] ; }
Get command handler for command message.

An exception will be thrown when command handler for command message payload name can not be found.

@param CommandMessageInterface $commandMessage
@return CommandHandlerInterface
@throws CommandDispatcherException
Get command handler for command message .