Router class that uses regular expressions for matching routes.
The routes are matched against the uri property of the request object.
Source for this file: /MvcTools/src/routes/regexp.php
Version: | //autogentag// |
protected string |
$action
Contains the action that the controller should execute. |
protected string |
$controllerClassName
This is the name of the controller class that will be instantiated with the request variables obtained from the route, as well as the default values belonging to a route. |
protected array(string) |
$defaultValues
The default values for the variables that are send to the controller. The route matchers can override those default values |
protected string |
$pattern
This property contains the regular expression. |
public ezcMvcRegexpRoute |
__construct(
$pattern
, $controllerClassName
, [ $action
= null] , [ $defaultValues
= array()] )
Constructs a new ezcMvcRegexpRoute with $pattern. |
public void |
generateUrl(
[ $arguments
= null] )
Generates an URL back out of a route, including possible arguments |
protected string |
getUriString(
$request
)
Returns the request information that the matches() method will match the pattern against. |
public null|ezcMvcRoutingInformation |
matches(
$request
)
Evaluates the URI against this route. |
public void |
prefix(
$prefix
)
Parses the pattern and adds the prefix. |
protected bool |
pregMatch(
$request
, &$matches
, $matches
)
This method performs the actual regular expresion match against the $request's URI. |
Constructs a new ezcMvcRegexpRoute with $pattern.
When the route is matched (with the match() method), the route instantiates an object of the class $controllerClassName.
Name | Type | Description |
---|---|---|
$pattern |
string | |
$controllerClassName |
string | |
$action |
string | |
$defaultValues |
array(string) |
Generates an URL back out of a route, including possible arguments
Name | Type | Description |
---|---|---|
$arguments |
array |
Method | Description |
---|---|
ezcMvcReversibleRoute::generateUrl() |
Generates an URL back out of a route, including possible arguments |
Returns the request information that the matches() method will match the pattern against.
Name | Type | Description |
---|---|---|
$request |
ezcMvcRequest |
Evaluates the URI against this route.
The method first runs the match. If the regular expression matches, it cleans up the variables to only include named parameters. it then creates an object containing routing information and returns it. If the route's pattern did not match it returns null.
Name | Type | Description |
---|---|---|
$request |
ezcMvcRequest |
Method | Description |
---|---|
ezcMvcRoute::matches() |
Returns routing information if the route matched, or null in case the route did not match. |
Parses the pattern and adds the prefix.
It's up to the developer to provide a meaningfull prefix. In this case, it needs to be a regular expression just like the pattern.
Name | Type | Description |
---|---|---|
$prefix |
mixed |
Type | Description |
---|---|
ezcMvcRegexpRouteException |
if the prefix can not be prepended to the pattern. |
Method | Description |
---|---|
ezcMvcRoute::prefix() |
Adds a prefix to the route. |
This method performs the actual regular expresion match against the $request's URI.
Name | Type | Description |
---|---|---|
$request |
ezcMvcRequest | |
$matches |
array(string) | |
&$matches |