Route

Implements interface and provides convenience methods

package Zend_Controller
subpackage Router
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
see
inherited_from \Zend_Controller_Router_Route_Abstract

 Methods

Prepares the route for mapping by splitting (exploding) it to a corresponding atomic parts. These parts are assigned a position which is later used for matching and preparing values.

__construct(string $route, array $defaults = array(), array $reqs = array(), \Zend_Translate $translator = null, mixed|null $locale = null

Parameters

$route

string

Map used to match with later submitted URL path

$defaults

array

Defaults for map variables with keys as variable names

$reqs

array

Regular expression requirements for variables (keys as variable names)

$translator

\Zend_Translate

Translator to use for this instance

$locale

mixednull

Assembles user submitted parameters forming a URL path defined by this route

assemble(array $data = array(), boolean $reset = false, boolean $encode = false, boolean $partial = false) : string

Parameters

$data

array

An array of variable and value pairs used as parameters

$reset

boolean

Whether or not to set route defaults with those provided in $data

$encode

boolean

$partial

boolean

Exceptions

\Zend_Controller_Router_Exception

Returns

stringRoute path with user submitted parameters

Create a new chain

chain(\Zend_Controller_Router_Route_Abstract $route, string $separator = '/') : \Zend_Controller_Router_Route_Chain
Inherited

Parameters

$route

\Zend_Controller_Router_Route_Abstract

$separator

string

Returns

\Zend_Controller_Router_Route_Chain

Return a single parameter of route's defaults

getDefault(string $name) : string

Parameters

$name

string

Array key of the parameter

Returns

stringPreviously set default

Get the default locale

getDefaultLocale() : mixed
Static

Returns

mixed

Get the default translator

getDefaultTranslator() : \Zend_Translate
Static

Returns

\Zend_Translate

Return an array of defaults

getDefaults() : array

Returns

arrayRoute defaults

Instantiates route based on passed Zend_Config structure

getInstance(\Zend_Config $config) : \Zend_Controller_Router_Route
Static

Parameters

$config

\Zend_Config

Configuration object

Returns

\Zend_Controller_Router_Route

Get the locale

getLocale() : mixed

Returns

mixed

Get partially matched path

getMatchedPath() : string
Inherited

Returns

string

Get the translator

getTranslator() : \Zend_Translate

Exceptions

\Zend_Controller_Router_Exception When no translator can be found

Returns

\Zend_Translate

Get all variables which are used by the route

getVariables() : array

Returns

array

Get the version of the route

getVersion() 
inherited_from \Zend_Controller_Router_Route_Abstract::getVersion()

Get the version of the route

getVersion() : integer
Inherited

Returns

integer

Check or set wether this is an abstract route or not

isAbstract(boolean $flag = null) : boolean
Inherited

Parameters

$flag

boolean

Returns

boolean

Matches a user submitted path with parts defined by a map. Assigns and returns an array of variables on a successful match.

match(string $path, boolean $partial = false) : array | false

Parameters

$path

string

Path used to match against this routing map

$partial

boolean

Exceptions

\Zend_Controller_Router_Exception

Returns

arrayfalseAn array of assigned values or a false on a mismatch

Set a default locale

setDefaultLocale(mixed $locale = null) : void
Static

Parameters

$locale

mixed

Set a default translator

setDefaultTranslator(\Zend_Translate $translator = null) : void
Static

Parameters

$translator

\Zend_Translate

Set a locale

setLocale(mixed $locale) : void

Parameters

$locale

mixed

Set partially matched path

setMatchedPath(string $path) : void
Inherited

Parameters

$path

string

Set a translator

setTranslator(\Zend_Translate $translator) : void

Parameters

$translator

\Zend_Translate

 Properties

 

Default locale

$_defaultLocale : mixed

Default

Static
 

$_defaultRegex

$_defaultRegex 

Default

null
 

Default translator

$_defaultTranslator : \Zend_Translate

Default

Static
 

Holds user submitted default values for route's variables. Name and value pairs.

$_defaults : array

Default

array()
 

Wether this route is abstract or not

$_isAbstract : boolean

Default

false
 

Wether this is a translated route or not

$_isTranslated : boolean

Default

false
 

Locale

$_locale : mixed

Default

 

Path matched by this route

$_matchedPath : string

Default

null
 

Holds Route patterns for all URL parts. In case of a variable it stores it's regex requirement or null. In case of a static part, it holds only it's direct value.

$_parts : array

Default

array()

In case of a wildcard, it stores an asterisk (*)

 

$_regexDelimiter

$_regexDelimiter 

Default

'#'
 

Holds user submitted regular expression patterns for route's variables' values.

$_requirements : array

Default

array()

Name and value pairs.

 

Helper var that holds a count of route pattern's static parts for validation

$_staticCount : integer

Default

0
 

Translatable variables

$_translatable : array

Default

array()
 

Translator

$_translator : \Zend_Translate

Default

 

$_urlDelimiter

$_urlDelimiter 

Default

self::URI_DELIMITER
 

$_urlVariable

$_urlVariable 

Default

':'
 

Associative array filled on match() that holds matched path values for given variable names.

$_values : array

Default

array()
 

Holds names of all route's pattern variable names. Array index holds a position in URL.

$_variables : array

Default

array()
 

Associative array filled on match() that holds wildcard variable names and values.

$_wildcardData : array

Default

array()

 Constants

 

URI delimiter

URI_DELIMITER = '/'