Connector/ServiceBus/CommandHandlerMiddleware/CommandHandlerMiddleware.php
public function execute($command, callable $next)
    {
        if (null === $this->handlers) {
            return $next($command);
        }

        if (!($command instanceof CommandInterface)) {
            return $next($command);
        }

        $handlers = array_filter($this->handlers, function (CommandHandlerInterface $handler) use ($command) {
            return $handler->supports($command);
        });

        if (0 === count($handlers)) {
            throw NotFoundException::fromCommand($command);
        }

        foreach ($handlers as $handler) {
            $handler->handle($command);
        }

        return $next($command);
    }
public function execute($command, callable $next)
    {
        if (null === $this->handlers) {
            return $next($command);
        }

        if (!($command instanceof CommandInterface)) {
            return $next($command);
        }

        $handlers = array_filter($this->handlers, function (CommandHandlerInterface $handler) use ($command) {
            return $handler->supports($command);
        });

        if (0 === count($handlers)) {
            throw NotFoundException::fromCommand($command);
        }

        foreach ($handlers as $handler) {
            $handler->handle($command);
        }

        return $next($command);
    }
{@inheritdoc}