authorizationChecker = $authorizationChecker; } /** * @param object $command * @param callable $next * * @return mixed */ 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)) ); } }