Controller/Router/Route.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Controller
- Subpackage
- Router
- Version
- $Id: Route.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Controller_Router_Route
Route
Implements interface and provides convenience methods
- Parent(s)
- \Zend_Controller_Router_Route_Abstract
- See
- \global\http://manuals.rubyonrails.com/read/chapter/65
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

array $_defaults = array()Holds user submitted default values for route's variables.
Name and value pairs.
array()Details- Type
- array

boolean $_isAbstract = falseWether this route is abstract or not
Inherited from: \Zend_Controller_Router_Route_Abstract::$$_isAbstractfalseDetails- Type
- boolean
- Inherited_from
- \Zend_Controller_Router_Route_Abstract::$$_isAbstract

boolean $_isTranslated = falseWether this is a translated route or not
falseDetails- Type
- boolean

string $_matchedPath = nullPath matched by this route
Inherited from: \Zend_Controller_Router_Route_Abstract::$$_matchedPathnullDetails- Type
- string
- Inherited_from
- \Zend_Controller_Router_Route_Abstract::$$_matchedPath

array $_parts = array()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. In case of a wildcard, it stores an asterisk (*)
array()Details- Type
- array

array $_requirements = array()Holds user submitted regular expression patterns for route's variables' values.
Name and value pairs.
array()Details- Type
- array

int $_staticCount = 0Helper var that holds a count of route pattern's static parts for validation
0Details- Type
- int

array $_values = array()Associative array filled on match() that holds matched path values for given variable names.
array()Details- Type
- array

array $_variables = array()Holds names of all route's pattern variable names.
Array index holds a position in URL.
array()Details- Type
- array
Methods

__construct(string $route, array $defaults = array(), array $reqs = array(), \Zend_Translate $translator = null, $locale = null) : voidPrepares 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.
| Name | Type | Description |
|---|---|---|
| $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 |

assemble(array $data = array(), boolean $reset = false, $encode = false, $partial = false) : stringAssembles user submitted parameters forming a URL path defined by this route
| Name | Type | Description |
|---|---|---|
| $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 | ||
| $partial |
| Type | Description |
|---|---|
| string | Route path with user submitted parameters |

chain(\Zend_Controller_Router_Route_Abstract $route, string $separator = '/') : \Zend_Controller_Router_Route_Chain
| Name | Type | Description |
|---|---|---|
| $route | \Zend_Controller_Router_Route_Abstract | |
| $separator | string |
| Type | Description |
|---|---|
| \Zend_Controller_Router_Route_Chain |

getDefault(string $name) : stringReturn a single parameter of route's defaults
| Name | Type | Description |
|---|---|---|
| $name | string | Array key of the parameter |
| Type | Description |
|---|---|
| string | Previously set default |

getDefaultTranslator() : \Zend_TranslateGet the default translator
| Type | Description |
|---|---|
| \Zend_Translate |

getInstance(\Zend_Config $config) : voidInstantiates route based on passed Zend_Config structure
| Name | Type | Description |
|---|---|---|
| $config | \Zend_Config | Configuration object |

getMatchedPath() : stringGet partially matched path
Inherited from: \Zend_Controller_Router_Route_Abstract::getMatchedPath()| Type | Description |
|---|---|
| string |

getTranslator() : \Zend_TranslateGet the translator
| Type | Description |
|---|---|
| \Zend_Translate |
| Exception | Description |
|---|---|
| \Zend_Controller_Router_Exception | When no translator can be found |

isAbstract(boolean $flag = null) : booleanCheck or set wether this is an abstract route or not
Inherited from: \Zend_Controller_Router_Route_Abstract::isAbstract()| Name | Type | Description |
|---|---|---|
| $flag | boolean |
| Type | Description |
|---|---|
| boolean |

match(string $path, $partial = false) : array | falseMatches a user submitted path with parts defined by a map.
Assigns and returns an array of variables on a successful match.
| Name | Type | Description |
|---|---|---|
| $path | string | Path used to match against this routing map |
| $partial |
| Type | Description |
|---|---|
| array | false | An array of assigned values or a false on a mismatch |

setDefaultLocale(mixed $locale = null) : voidSet a default locale
| Name | Type | Description |
|---|---|---|
| $locale | mixed |

setDefaultTranslator(\Zend_Translate $translator = null) : voidSet a default translator
| Name | Type | Description |
|---|---|---|
| $translator | \Zend_Translate |

setMatchedPath(string $path) : voidSet partially matched path
Inherited from: \Zend_Controller_Router_Route_Abstract::setMatchedPath()| Name | Type | Description |
|---|---|---|
| $path | string |

setTranslator(\Zend_Translate $translator) : voidSet a translator
| Name | Type | Description |
|---|---|---|
| $translator | \Zend_Translate |