Skip to content

Commit

Permalink
Fixes DocBlocks in Zend_Controller_Router - Closes zendframework#434
Browse files Browse the repository at this point in the history
  • Loading branch information
froschdesign authored and Dimitris Giotas committed Jun 17, 2016
1 parent 28561b1 commit 829886d
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 24 deletions.
9 changes: 4 additions & 5 deletions library/Zend/Controller/Router/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ abstract class Zend_Controller_Router_Abstract implements Zend_Controller_Router
* Constructor
*
* @param array $params
* @return void
*/
public function __construct(array $params = array())
{
Expand All @@ -69,8 +68,8 @@ public function __construct(array $params = array())
* Add or modify a parameter to use when instantiating an action controller
*
* @param string $name
* @param mixed $value
* @return Zend_Controller_Router
* @param mixed $value
* @return Zend_Controller_Router_Abstract
*/
public function setParam($name, $value)
{
Expand All @@ -83,7 +82,7 @@ public function setParam($name, $value)
* Set parameters to pass to action controller constructors
*
* @param array $params
* @return Zend_Controller_Router
* @return Zend_Controller_Router_Abstract
*/
public function setParams(array $params)
{
Expand Down Expand Up @@ -124,7 +123,7 @@ public function getParams()
* each.
*
* @param null|string|array single key or array of keys for params to clear
* @return Zend_Controller_Router
* @return Zend_Controller_Router_Abstract
*/
public function clearParams($name = null)
{
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Controller/Router/Interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function setFrontController(Zend_Controller_Front $controller);
* Add or modify a parameter with which to instantiate any helper objects
*
* @param string $name
* @param mixed $param
* @param mixed $value
* @return Zend_Controller_Router_Interface
*/
public function setParam($name, $value);
Expand Down
14 changes: 11 additions & 3 deletions library/Zend/Controller/Router/Rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
/**
* Currently matched route
*
* @var Zend_Controller_Router_Route_Interface
* @var string
*/
protected $_currentRoute = null;

Expand Down Expand Up @@ -283,7 +283,6 @@ public function removeRoute($name)
/**
* Remove all standard default routes
*
* @param Zend_Controller_Router_Route_Interface Route
* @return Zend_Controller_Router_Rewrite
*/
public function removeDefaultRoutes()
Expand Down Expand Up @@ -340,7 +339,7 @@ public function getCurrentRoute()
* Retrieve a name of currently matched route
*
* @throws Zend_Controller_Router_Exception
* @return Zend_Controller_Router_Route_Interface Route object
* @return string Route name
*/
public function getCurrentRouteName()
{
Expand All @@ -365,6 +364,7 @@ public function getRoutes()
* Find a matching route to the current PATH_INFO and inject
* returning values to the Request object.
*
* @param Zend_Controller_Request_Abstract $request
* @throws Zend_Controller_Router_Exception
* @return Zend_Controller_Request_Abstract Request object
*/
Expand Down Expand Up @@ -419,6 +419,14 @@ public function route(Zend_Controller_Request_Abstract $request)

}

/**
* Sets parameters for request object
*
* Module name, controller name and action name
*
* @param Zend_Controller_Request_Abstract $request
* @param array $params
*/
protected function _setRequestParams($request, $params)
{
foreach ($params as $param => $value) {
Expand Down
17 changes: 12 additions & 5 deletions library/Zend/Controller/Router/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public function getVersion() {
* Instantiates route based on passed Zend_Config structure
*
* @param Zend_Config $config Configuration object
* @return Zend_Controller_Router_Route
*/
public static function getInstance(Zend_Config $config)
{
Expand All @@ -150,10 +151,11 @@ public static function getInstance(Zend_Config $config)
* to a corresponding atomic parts. These parts are assigned
* a position which is later used for matching and preparing values.
*
* @param string $route Map used to match with later submitted URL path
* @param array $defaults Defaults for map variables with keys as variable names
* @param array $reqs Regular expression requirements for variables (keys as variable names)
* @param string $route Map used to match with later submitted URL path
* @param array $defaults Defaults for map variables with keys as variable names
* @param array $reqs Regular expression requirements for variables (keys as variable names)
* @param Zend_Translate $translator Translator to use for this instance
* @param mixed|null $locale
*/
public function __construct($route, $defaults = array(), $reqs = array(), Zend_Translate $translator = null, $locale = null)
{
Expand Down Expand Up @@ -199,7 +201,9 @@ public function __construct($route, $defaults = array(), $reqs = array(), Zend_T
* Matches a user submitted path with parts defined by a map. Assigns and
* returns an array of variables on a successful match.
*
* @param string $path Path used to match against this routing map
* @param string $path Path used to match against this routing map
* @param boolean $partial
* @throws Zend_Controller_Router_Exception
* @return array|false An array of assigned values or a false on a mismatch
*/
public function match($path, $partial = false)
Expand Down Expand Up @@ -311,8 +315,11 @@ public function match($path, $partial = false)
/**
* Assembles user submitted parameters forming a URL path defined by this route
*
* @param array $data An array of variable and value pairs used as parameters
* @param array $data An array of variable and value pairs used as parameters
* @param boolean $reset Whether or not to set route defaults with those provided in $data
* @param boolean $encode
* @param boolean $partial
* @throws Zend_Controller_Router_Exception
* @return string Route path with user submitted parameters
*/
public function assemble($data = array(), $reset = false, $encode = false, $partial = false)
Expand Down
11 changes: 11 additions & 0 deletions library/Zend/Controller/Router/Route/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@
*/
class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Abstract
{
/**
* Routes
*
* @var array
*/
protected $_routes = array();

/**
* Separators
*
* @var array
*/
protected $_separators = array();

/**
Expand Down
31 changes: 28 additions & 3 deletions library/Zend/Controller/Router/Route/Hostname.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,68 @@
*/
class Zend_Controller_Router_Route_Hostname extends Zend_Controller_Router_Route_Abstract
{

/**
* Host variable
*
* @var string
*/
protected $_hostVariable = ':';

/**
* Regex delimiter
*
* @var string
*/
protected $_regexDelimiter = '#';

/**
* Default regex string
*
* @var string|null
*/
protected $_defaultRegex = null;

/**
* Holds names of all route's pattern variable names. Array index holds a position in host.
*
* @var array
*/
protected $_variables = array();

/**
* Holds Route patterns for all host 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.
*
* @var array
*/
protected $_parts = array();

/**
* Holds user submitted default values for route's variables. Name and value pairs.
*
* @var array
*/
protected $_defaults = array();

/**
* Holds user submitted regular expression patterns for route's variables' values.
* Name and value pairs.
*
* @var array
*/
protected $_requirements = array();

/**
* Default scheme
*
* @var string
*/
protected $_scheme = null;

/**
* Associative array filled on match() that holds matched path values
* for given variable names.
*
* @var array
*/
protected $_values = array();
Expand All @@ -96,7 +118,6 @@ class Zend_Controller_Router_Route_Hostname extends Zend_Controller_Router_Route
* Set the request object
*
* @param Zend_Controller_Request_Abstract|null $request
* @return void
*/
public function setRequest(Zend_Controller_Request_Abstract $request = null)
{
Expand All @@ -122,6 +143,7 @@ public function getRequest()
* Instantiates route based on passed Zend_Config structure
*
* @param Zend_Config $config Configuration object
* @return Zend_Controller_Router_Route_Hostname
*/
public static function getInstance(Zend_Config $config)
{
Expand Down Expand Up @@ -245,8 +267,11 @@ public function match($request)
/**
* Assembles user submitted parameters forming a hostname defined by this route
*
* @param array $data An array of variable and value pairs used as parameters
* @param array $data An array of variable and value pairs used as parameters
* @param boolean $reset Whether or not to set route defaults with those provided in $data
* @param boolean $encode
* @param boolean $partial
* @throws Zend_Controller_Router_Exception
* @return string Route path with user submitted parameters
*/
public function assemble($data = array(), $reset = false, $encode = false, $partial = false)
Expand Down
35 changes: 30 additions & 5 deletions library/Zend/Controller/Router/Route/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,27 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
{
/**
* Default values for the route (ie. module, controller, action, params)
*
* @var array
*/
protected $_defaults;

protected $_values = array();
/**
* Default values for the route (ie. module, controller, action, params)
*
* @var array
*/
protected $_values = array();

/**
* @var boolean
*/
protected $_moduleValid = false;
protected $_keysSet = false;

/**
* @var boolean
*/
protected $_keysSet = false;

/**#@+
* Array keys to use for module, controller, and action. Should be taken out of request.
Expand All @@ -65,12 +79,20 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
*/
protected $_request;

/**
* Get the version of the route
*
* @return int
*/
public function getVersion() {
return 1;
}

/**
* Instantiates route based on passed Zend_Config structure
*
* @param Zend_Config $config
* @return Zend_Controller_Router_Route_Module
*/
public static function getInstance(Zend_Config $config)
{
Expand Down Expand Up @@ -137,7 +159,8 @@ protected function _setRequestKeys()
* setControllerName(), and setActionName() accessors to set those values.
* Always returns the values as an array.
*
* @param string $path Path used to match against this routing map
* @param string $path Path used to match against this routing map
* @param boolean $partial
* @return array An array of assigned values or a false on a mismatch
*/
public function match($path, $partial = false)
Expand Down Expand Up @@ -190,8 +213,10 @@ public function match($path, $partial = false)
/**
* Assembles user submitted parameters forming a URL path defined by this route
*
* @param array $data An array of variable and value pairs used as parameters
* @param bool $reset Weither to reset the current params
* @param array $data An array of variable and value pairs used as parameters
* @param boolean $reset Weither to reset the current params
* @param boolean $encode
* @param boolean $partial
* @return string Route path with user submitted parameters
*/
public function assemble($data = array(), $reset = false, $encode = true, $partial = false)
Expand Down
Loading

0 comments on commit 829886d

Please sign in to comment.