@param object $command
@param callable $next

@return mixed
515953
public function execute($command, callable $next)
    {
        if (! $command instanceof NamedCommand) {
            throw new \InvalidArgumentException('Command must be a NamedCommand');
        }

        $this->queuePublisher->publish($this->serializer->serialize($command), $command->getCommandName());
    }
1330302
public function handle(AbstractCommand $command)
    {
        $this->commandDispatcher->handle($command);
        // Now that the command is handled, let's found if there is some events to publish
        $events = $this->extractEventsFromCommand($command);
        foreach ($events as $event) {
            // we will only publish event to synchronous listeners
            $this->publish($event);
        }

        return $command;
    }
31589
public function execute($command, callable $next)
    {
        $repository = Manager::getRepository(User::class);

        if (!$user = $repository->findOneBy(['lineUserId' => $command->input->userId])) {
            $user = new User();
        }

        $command->storage = $user;
        $command->merge((array) $user->getLineCommandData());

        $user->setLineUserId($command->input->userId);

        return $next($command);
    }
983613
public function execute($command, callable $next)
    {
        $result = $next($command);

        $events = $this->eventStorage->release();
        $this->emitEvents($events);

        return $result;
    }
1086162
public function execute(Command $command)
    {
        if ($this->locked === true) {
            $this->queue[] = $command;
            return null;
        }

        $this->locked = true;

        $response = $this->executeIgnoringLock($command);

        $this->executeQueue();

        $this->locked = false;

        return $response;
    }
518105
public function execute($command, callable $next)
    {
        $constraintViolations = $this->validator->validate($command);

        if (count($constraintViolations) > 0) {
            throw InvalidCommandException::onCommand($command, $constraintViolations);
        }

        return $next($command);
    }
853266
public function execute(Command $command, callable $next)
    {
        $result = $next($command);

        if ($this->stopwatch) {
            $lap = $this->stopwatch->lap('parser.parse');
            $oldMemory = $this->memory;
            $periods = $lap->getPeriods();
            $memory = end($periods)->getMemory();

            $this->log(
                '>> Memory after processing of file: ' . number_format($memory / 1024 / 1024, 2)
                . ' megabytes (' . (($memory - $oldMemory >= 0)
                    ? '+'
                    : '-') . number_format(($memory - $oldMemory) / 1024)
                . ' kilobytes)',
                LogLevel::DEBUG
            );

            $this->memory = $memory;
        }

        return $result;
    }
1167916
public function get($command) {
        return isset($this->_commands[$command]) ?
            $this->_commands[$command] :
            null;
    }
1093270
public function execute($command, callable $next)
    {
        $violations = $this->validator->validate($command);

        if ($violations->count() > 0) {
            throw new ValidationException(
                sprintf('Invalid command %s given', get_class($command)),
                0,
                null,
                $violations
            );
        }

        return $next($command);
    }
558241
public function execute($command, callable $next)
    {
        try {
            return $next($command);
        } catch (NotAuthenticatedException $exception) {
            return $this->handleAuthenticationError($command, $exception);
        } catch (DomainException|\DomainException $domainException) {
            return $this->handleDomainException($command, $domainException);
        } catch (\InvalidArgumentException $argumentException) {
            return $this->handleArgumentException($command, $argumentException);
        } catch (\Exception $exception) {
            return $this->handleUnclassifiedError($command, $exception);
        }
    }
550849
public function execute($command, callable $next)
    {
        // dev only
        if ($this->isDebug && $command->logs) {
            VarDumper::dump($command->logs);
        }

        return $next($command);
    }
1271894
public function execute($command, callable $next)
    {
        if ($this->authorizationChecker->isGranted('handle', $command)) {
            return $next($command);
        }

        throw new AccessDeniedException(
            sprintf('The current user is not allowed to handle command of type \'%s\'', get_class($command))
        );
    }
800868
public function get($command)
    {
        $commands = $this->getHandlers();
        return empty($commands[$command]) ? array() : $commands[$command];
    }
764531
public function execute(Command $command)
    {
        if ($command instanceof QueueableCommand) {
            $this->queuer->queue($command);
            return null;
        }

        return $this->innerCommandBus->execute($command);
    }
321267
public function get($command)
    {
        $className = ucfirst($command);
        $className = "PortaText\\Command\\Api\\$className";
        if (!class_exists($className)) {
            throw new \InvalidArgumentException(
                "Command $command does not exist"
            );
        }
        return new $className();
    }
517716
public function execute($command, callable $next)
    {
        $commandName = $this->commandNameExtractor->extract($command);
        $handler = $this->handlerLocator->getHandlerForCommand($commandName);
        $methodName = $this->methodNameInflector->inflect($command, $handler);

        // is_callable is used here instead of method_exists, as method_exists
        // will fail when given a handler that relies on __call.
        if (!is_callable([$handler, $methodName])) {
            throw CanNotInvokeHandlerException::forCommand(
                $command,
                "Method '{$methodName}' does not exist on handler"
            );
        }

        return $handler->{$methodName}($command);
    }
934454
public function execute($command, callable $next)
    {
        if ($this->user->getId() === null) {
            throw new NotAuthenticatedException();
        }

        if (!$this->user->can($this->permission)) {
            throw new InsufficientPermissionsException($this->permission);
        }

        return $next($command);
    }