interface PathValidatorInterface (View source)

Provides an interface for url path validators.

Methods

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.

bool
isValid(string $path)

Checks if the URL path is valid and accessible by the current user.

Details

Url|false getUrlIfValid(string $path)

Returns a URL object, if the path is valid and accessible.

Parameters

string $path

The path to check.

Return Value

Url|false

The url object, or FALSE if the path is not valid.

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.

Parameters

string $path

The path to check.

Return Value

Url|false

The url object, or FALSE if the path is not valid.

bool isValid(string $path)

Checks if the URL path is valid and accessible by the current user.

Parameters

string $path

The path to check.

Return Value

bool

TRUE if the path is valid.