protected function PathValidator::getPathAttributes

protected PathValidator::getPathAttributes($path, Request $request, $access_check)

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.

File

core/lib/Drupal/Core/Path/PathValidator.php, line 147

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;
  }
  catch (MethodNotAllowedException $e) {
    return FALSE;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Path!PathValidator.php/function/PathValidator::getPathAttributes/8.1.x