$routePath
$routePath : string
The path for this route, such as ':controller/:action/:id'
The Route object holds a route recognition and generation routine.
See __construct() docs for usage.
__construct( $routePath, $kargs = array())
Initialize a route, with a given routepath for matching/generation
The set of keyword args will be used as defaults.
Usage: $route = new Horde_Routes_Route(':controller/:action/:id');
$route = new Horde_Routes_Route('date/:year/:month/:day',
array('controller'=>'blog', 'action'=>'view'));
$route = new Horde_Routes_Route('archives/:page',
array('controller'=>'blog', 'action'=>'by_page',
'requirements' => array('page'=>'\d{1,2}'));
Note: Route is generally not called directly, a Mapper instance connect() method should be used to add routes.
| $routePath | ||
| $kargs |
makeRegexp(array $clist) : void
Create the regular expression for matching.
Note: This MUST be called before match can function properly.
clist should be a list of valid controller strings that can be matched, for this reason makeregexp should be called by the web framework after it knows all available controllers that can be utilized.
| array | $clist | List of all possible controllers |
buildNextReg(array $path, array $clist) : array
Recursively build a regexp given a path, and a controller list.
Returns the regular expression string, and two booleans that can be ignored as they're only used internally by buildnextreg.
| array | $path | The RouteList for the path |
| array | $clist | List of all possible controllers |
[array, boolean, boolean]
match(string $url, $kargs = array()) : null|array
Match a url to our regexp.
While the regexp might match, this operation isn't guaranteed as there's other factors that can cause a match to fail even though the regexp succeeds (Default that was relied on wasn't given, requirement regexp doesn't pass, etc.).
Therefore the calling function shouldn't assume this will return a valid dict, the other possible return is False if a match doesn't work out.
| string | $url | URL to match |
| $kargs |
Array of match data if matched, Null otherwise
_defaults( $routeKeys, array $reservedKeys, array $kargs) : array
Creates a default array of strings
Puts together the array of defaults, turns non-null values to strings, and add in our action/id default if they use and do not specify it
Precondition: $this->_defaultKeys is an array of the currently assumed default keys
| $routeKeys | ||
| array | $reservedKeys | Array of keys not in the route path |
| array | $kargs | Keyword args passed to the Route constructor |
[defaults, new default keys]