/** * Dispatch command * * @param DTO $command * @param Closure|null $afterResolving * @return void */ public function dispatch($command, Closure $afterResolving = null) { if ($this->commandShouldBeQueued($command)) { $this->dispatcher->dispatchToQueue($command); } else { $this->dispatcher->dispatchNow($command, $afterResolving); } }