From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- .../vendor/Zend/Controller/Router/Route/Static.php | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 library/vendor/Zend/Controller/Router/Route/Static.php (limited to 'library/vendor/Zend/Controller/Router/Route/Static.php') diff --git a/library/vendor/Zend/Controller/Router/Route/Static.php b/library/vendor/Zend/Controller/Router/Route/Static.php new file mode 100644 index 0000000..86363da --- /dev/null +++ b/library/vendor/Zend/Controller/Router/Route/Static.php @@ -0,0 +1,148 @@ +defaults instanceof Zend_Config) ? $config->defaults->toArray() : array(); + + return new self($config->route, $defs); + } + + /** + * Prepares the route for mapping. + * + * @param string $route Map used to match with later submitted URL path + * @param array $defaults Defaults for map variables with keys as variable names + */ + public function __construct($route, $defaults = array()) + { + $this->_route = trim($route, self::URI_DELIMITER); + $this->_defaults = (array) $defaults; + } + + /** + * Matches a user submitted path with a previously defined route. + * Assigns and returns an array of defaults on a successful match. + * + * @param string $path Path used to match against this routing map + * @return array|false An array of assigned values or a false on a mismatch + */ + public function match($path, $partial = false) + { + if ($partial) { + if ((empty($path) && empty($this->_route)) + || (substr($path, 0, strlen($this->_route)) === $this->_route) + ) { + $this->setMatchedPath($this->_route); + + return $this->_defaults; + } + } else { + if (trim($path, self::URI_DELIMITER) == $this->_route) { + return $this->_defaults; + } + } + + return false; + } + + /** + * Assembles a URL path defined by this route + * + * @param array $data An array of variable and value pairs used as parameters + * @return string Route path with user submitted parameters + */ + public function assemble($data = array(), $reset = false, $encode = false, $partial = false) + { + return $this->_route; + } + + /** + * Return a single parameter of route's defaults + * + * @param string $name Array key of the parameter + * @return string Previously set default + */ + public function getDefault($name) + { + if (isset($this->_defaults[$name])) { + return $this->_defaults[$name]; + } + + return null; + } + + /** + * Return an array of defaults + * + * @return array Route defaults + */ + public function getDefaults() + { + return $this->_defaults; + } +} -- cgit v1.2.3