You are here

protected function PathValidator::getPathAttributes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Path/PathValidator.php \Drupal\Core\Path\PathValidator::getPathAttributes()

Gets the matched attributes for a given path.

Parameters

string $path: The path to check.

\Symfony\Component\HttpFoundation\Request $request: A request object with the given path.

bool $access_check: If FALSE then skip access check and check only whether the path is valid.

Return value

array|bool An array of request attributes of FALSE if an exception was thrown.

1 call to PathValidator::getPathAttributes()
PathValidator::getUrl in core/lib/Drupal/Core/Path/PathValidator.php
Helper for getUrlIfValid() and getUrlIfValidWithoutAccessCheck().

File

core/lib/Drupal/Core/Path/PathValidator.php, line 151
Contains \Drupal\Core\Path\PathValidator.

Class

PathValidator
Provides a default path validator and access checker.

Namespace

Drupal\Core\Path

Code

protected function getPathAttributes($path, Request $request, $access_check) {
  if (!$access_check || $this->account
    ->hasPermission('link to any page')) {
    $router = $this->accessUnawareRouter;
  }
  else {
    $router = $this->accessAwareRouter;
  }
  $path = $this->pathProcessor
    ->processInbound('/' . $path, $request);
  try {
    return $router
      ->match($path);
  } catch (ResourceNotFoundException $e) {
    return FALSE;
  } catch (ParamNotConvertedException $e) {
    return FALSE;
  } catch (AccessDeniedHttpException $e) {
    return FALSE;
  }
}