UrlRuleInterface
in
UrlRuleInterface is the interface that should be implemented by URL rule classes.
Tags
Table of Contents
Methods
- createUrl() : string|bool
- Creates a URL according to the given route and parameters.
- parseRequest() : array<string|int, mixed>|bool
- Parses the given request and returns the corresponding route and parameters.
Methods
createUrl()
Creates a URL according to the given route and parameters.
public
createUrl(UrlManager $manager, string $route, array<string|int, mixed> $params) : string|bool
Parameters
- $manager : UrlManager
-
the URL manager
- $route : string
-
the route. It should not have slashes at the beginning or the end.
- $params : array<string|int, mixed>
-
the parameters
Return values
string|bool —the created URL, or false if this rule cannot be used for creating this URL.
parseRequest()
Parses the given request and returns the corresponding route and parameters.
public
parseRequest(UrlManager $manager, Request $request) : array<string|int, mixed>|bool
Parameters
- $manager : UrlManager
-
the URL manager
- $request : Request
-
the request component
Return values
array<string|int, mixed>|bool —the parsing result. The route and the parameters are returned as an array. If false, it means this rule cannot be used to parse this path info.