web/lib/Zend/Controller/Router/Route/Module.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
--- a/web/lib/Zend/Controller/Router/Route/Module.php	Thu May 07 15:10:09 2015 +0200
+++ b/web/lib/Zend/Controller/Router/Route/Module.php	Thu May 07 15:16:02 2015 +0200
@@ -15,8 +15,8 @@
  * @category   Zend
  * @package    Zend_Controller
  * @subpackage Router
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @version    $Id: Module.php 24593 2012-01-05 20:35:02Z matthew $
+ * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version    $Id$
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -30,24 +30,40 @@
  *
  * @package    Zend_Controller
  * @subpackage Router
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  * @see        http://manuals.rubyonrails.com/read/chapter/65
  */
 class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_Abstract
 {
+
     /**
      * 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.
+     *
      * @var string
      */
     protected $_moduleKey     = 'module';
@@ -65,12 +81,21 @@
      */
     protected $_request;
 
-    public function getVersion() {
+    /**
+     * 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)
     {
@@ -86,13 +111,15 @@
     /**
      * Constructor
      *
-     * @param array $defaults Defaults for map variables with keys as variable names
+     * @param array                                $defaults   Defaults for map variables with keys as variable names
      * @param Zend_Controller_Dispatcher_Interface $dispatcher Dispatcher object
-     * @param Zend_Controller_Request_Abstract $request Request object
+     * @param Zend_Controller_Request_Abstract     $request    Request object
      */
-    public function __construct(array $defaults = array(),
-                Zend_Controller_Dispatcher_Interface $dispatcher = null,
-                Zend_Controller_Request_Abstract $request = null)
+    public function __construct(
+        array $defaults = array(),
+        Zend_Controller_Dispatcher_Interface $dispatcher = null,
+        Zend_Controller_Request_Abstract $request = null
+    )
     {
         $this->_defaults = $defaults;
 
@@ -137,7 +164,8 @@
      * 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)
@@ -158,7 +186,7 @@
 
             if ($this->_dispatcher && $this->_dispatcher->isValidModule($path[0])) {
                 $values[$this->_moduleKey] = array_shift($path);
-                $this->_moduleValid = true;
+                $this->_moduleValid        = true;
             }
 
             if (count($path) && !empty($path[0])) {
@@ -171,9 +199,9 @@
 
             if ($numSegs = count($path)) {
                 for ($i = 0; $i < $numSegs; $i = $i + 2) {
-                    $key = urldecode($path[$i]);
-                    $val = isset($path[$i + 1]) ? urldecode($path[$i + 1]) : null;
-                    $params[$key] = (isset($params[$key]) ? (array_merge((array) $params[$key], array($val))): $val);
+                    $key          = urldecode($path[$i]);
+                    $val          = isset($path[$i + 1]) ? urldecode($path[$i + 1]) : null;
+                    $params[$key] = (isset($params[$key]) ? (array_merge((array)$params[$key], array($val))) : $val);
                 }
             }
         }
@@ -190,8 +218,10 @@
     /**
      * 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)
@@ -236,24 +266,32 @@
                     $url .= self::URI_DELIMITER . $arrayValue;
                 }
             } else {
-                if ($encode) $value = urlencode($value);
+                if ($encode) {
+                    $value = urlencode($value);
+                }
                 $url .= self::URI_DELIMITER . $key;
                 $url .= self::URI_DELIMITER . $value;
             }
         }
 
         if (!empty($url) || $action !== $this->_defaults[$this->_actionKey]) {
-            if ($encode) $action = urlencode($action);
+            if ($encode) {
+                $action = urlencode($action);
+            }
             $url = self::URI_DELIMITER . $action . $url;
         }
 
         if (!empty($url) || $controller !== $this->_defaults[$this->_controllerKey]) {
-            if ($encode) $controller = urlencode($controller);
+            if ($encode) {
+                $controller = urlencode($controller);
+            }
             $url = self::URI_DELIMITER . $controller . $url;
         }
 
         if (isset($module)) {
-            if ($encode) $module = urlencode($module);
+            if ($encode) {
+                $module = urlencode($module);
+            }
             $url = self::URI_DELIMITER . $module . $url;
         }
 
@@ -266,7 +304,8 @@
      * @param string $name Array key of the parameter
      * @return string Previously set default
      */
-    public function getDefault($name) {
+    public function getDefault($name)
+    {
         if (isset($this->_defaults[$name])) {
             return $this->_defaults[$name];
         }
@@ -277,8 +316,8 @@
      *
      * @return array Route defaults
      */
-    public function getDefaults() {
+    public function getDefaults()
+    {
         return $this->_defaults;
     }
-
 }