You are here

protected function AccessManagerWrapper::performCheck in Devel 4.x

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Access/AccessManagerWrapper.php \Drupal\webprofiler\Access\AccessManagerWrapper::performCheck()
  2. 8 webprofiler/src/Access/AccessManagerWrapper.php \Drupal\webprofiler\Access\AccessManagerWrapper::performCheck()
  3. 8.2 webprofiler/src/Access/AccessManagerWrapper.php \Drupal\webprofiler\Access\AccessManagerWrapper::performCheck()

Performs the specified access check.

Parameters

string $service_id: The access check service ID to use.

\Drupal\Component\Utility\ArgumentsResolverInterface $arguments_resolver: The parametrized arguments resolver instance.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Throws

\Drupal\Core\Access\AccessException Thrown when the access check returns an invalid value.

Overrides AccessManager::performCheck

1 call to AccessManagerWrapper::performCheck()
AccessManagerWrapper::check in webprofiler/src/Access/AccessManagerWrapper.php
Checks a route against applicable access check services.

File

webprofiler/src/Access/AccessManagerWrapper.php, line 60

Class

AccessManagerWrapper
Attaches access check services to routes and runs them on request.

Namespace

Drupal\webprofiler\Access

Code

protected function performCheck($service_id, ArgumentsResolverInterface $arguments_resolver, Request $request = NULL) {
  $callable = $this->checkProvider
    ->loadCheck($service_id);
  $arguments = $arguments_resolver
    ->getArguments($callable);

  /** @var \Drupal\Core\Access\AccessResultInterface $service_access **/
  $service_access = call_user_func_array($callable, $arguments);
  if (!$service_access instanceof AccessResultInterface) {
    throw new AccessException("Access error in {$service_id}. Access services must return an object that implements AccessResultInterface.");
  }
  if ($request) {
    $this->dataCollector
      ->addAccessCheck($service_id, $callable, $request);
  }
  return $service_access;
}