PathValidator
class PathValidator implements PathValidatorInterface (View source)
Provides a default path validator and access checker.
Properties
| protected AccessAwareRouterInterface | $accessAwareRouter | The access aware router. |
|
| protected UrlMatcherInterface | $accessUnawareRouter | A router implementation which does not check access. |
|
| protected AccountInterface | $account | The current user. |
|
| protected InboundPathProcessorInterface | $pathProcessor | The path processor. |
Methods
Creates a new PathValidator.
Checks if the URL path is valid and accessible by the current user.
Returns a URL object, if the path is valid and accessible.
Returns a URL object, if the path is valid.
Helper for getUrlIfValid() and getUrlIfValidWithoutAccessCheck().
Gets the matched attributes for a given path.
Details
__construct(AccessAwareRouterInterface $access_aware_router, UrlMatcherInterface $access_unaware_router, AccountInterface $account, InboundPathProcessorInterface $path_processor)
Creates a new PathValidator.
bool
isValid(string $path)
Checks if the URL path is valid and accessible by the current user.
Url|false
getUrlIfValid(string $path)
Returns a URL object, if the path is valid and accessible.
Url|false
getUrlIfValidWithoutAccessCheck(string $path)
Returns a URL object, if the path is valid.
Unlike getUrlIfValid(), access check is not performed. Do not use this method if the $path is about to be presented to a user.
protected
getUrl($path, $access_check)
Helper for getUrlIfValid() and getUrlIfValidWithoutAccessCheck().
protected array|bool
getPathAttributes(string $path, Request $request, bool $access_check)
Gets the matched attributes for a given path.