Overview

Packages

  • Horde
    • Routes
  • Routes

Classes

  • Horde_Routes_Exception
  • Horde_Routes_Mapper
  • Horde_Routes_Printer
  • Horde_Routes_Route
  • Horde_Routes_Utils
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Routes_Route

The Route object holds a route recognition and generation routine. See __construct() docs for usage.

Package: Routes
Located at Horde/Routes/Route.php
Methods summary
public
# __construct( mixed $routePath, mixed $kargs = array() )

Initialize a route, with a given routepath for matching/generation

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.

public
# makeRegexp( array $clist )

Create the regular expression for matching.

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.

Parameters

$clist
List of all possible controllers
public array
# buildNextReg( array $path, array $clist )

Recursively build a regexp given a path, and a controller list.

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.

Parameters

$path
The RouteList for the path
$clist
List of all possible controllers

Returns

array
[array, boolean, boolean]
public null|array
# match( string $url, array $kargs = array() )

Match a url to our regexp.

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.

Parameters

$url
URL to match
$kargs
arguments

Returns

null|array
Array of match data if matched, Null otherwise
public
# generate( array $kargs )

Generate a URL from ourself given a set of keyword arguments

Generate a URL from ourself given a set of keyword arguments

Parameters

$kargs
Keyword arguments
Properties summary
public string $routePath

The path for this route, such as ':controller/:action/:id'

The path for this route, such as ':controller/:action/:id'

#
public string $encoding

Encoding of this route (not yet supported)

Encoding of this route (not yet supported)

# 'utf-8'
public string $decodeErrors

What to do on decoding errors? 'ignore' or 'replace'

What to do on decoding errors? 'ignore' or 'replace'

# 'replace'
public string $static

Is this a static route?

Is this a static route?

#
public callable $filter

Filter function to operate on arguments before generation

Filter function to operate on arguments before generation

#
public boolean $absolute

Is this an absolute path? (Mapper will not prepend SCRIPT_NAME)

Is this an absolute path? (Mapper will not prepend SCRIPT_NAME)

#
public boolean $explicit

Does this route use explicit mode (no implicit defaults)?

Does this route use explicit mode (no implicit defaults)?

#
public array $defaults

Default keyword arguments for this route

Default keyword arguments for this route

# array()
public array $conditions

Array of keyword args for special conditions (method, subDomain, function)

Array of keyword args for special conditions (method, subDomain, function)

#
public array $maxKeys

Maximum keys that this route could utilize.

Maximum keys that this route could utilize.

#
public array $minKeys

Minimum keys required to generate this route

Minimum keys required to generate this route

#
public array $hardCoded

Default keywords that don't exist in the path; can't be changed by an incomng URL.

Default keywords that don't exist in the path; can't be changed by an incomng URL.

#
public array $reqs

Requirements for this route

Requirements for this route

#
public string $regexp

Regular expression for matching this route

Regular expression for matching this route

#
API documentation generated by ApiGen