File indexing completed on 2024-06-23 05:55:09

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Controller
0017  * @subpackage Router
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @version    $Id$
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  */
0022 
0023 /**
0024  * @see Zend_Controller_Router_Route_Interface
0025  */
0026 // require_once 'Zend/Controller/Router/Route/Interface.php';
0027 
0028 /**
0029  * Abstract Route
0030  *
0031  * Implements interface and provides convenience methods
0032  *
0033  * @package    Zend_Controller
0034  * @subpackage Router
0035  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0036  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0037  */
0038 abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_Router_Route_Interface
0039 {
0040     /**
0041      * URI delimiter
0042      */
0043     const URI_DELIMITER = '/';
0044 
0045     /**
0046      * Wether this route is abstract or not
0047      *
0048      * @var boolean
0049      */
0050     protected $_isAbstract = false;
0051 
0052     /**
0053      * Path matched by this route
0054      *
0055      * @var string
0056      */
0057     protected $_matchedPath = null;
0058 
0059     /**
0060      * Get the version of the route
0061      *
0062      * @return integer
0063      */
0064     public function getVersion()
0065     {
0066         return 2;
0067     }
0068 
0069     /**
0070      * Set partially matched path
0071      *
0072      * @param  string $path
0073      * @return void
0074      */
0075     public function setMatchedPath($path)
0076     {
0077         $this->_matchedPath = $path;
0078     }
0079 
0080     /**
0081      * Get partially matched path
0082      *
0083      * @return string
0084      */
0085     public function getMatchedPath()
0086     {
0087         return $this->_matchedPath;
0088     }
0089 
0090     /**
0091      * Check or set wether this is an abstract route or not
0092      *
0093      * @param  boolean $flag
0094      * @return boolean
0095      */
0096     public function isAbstract($flag = null)
0097     {
0098         if ($flag !== null) {
0099             $this->_isAbstract = $flag;
0100         }
0101 
0102         return $this->_isAbstract;
0103     }
0104 
0105     /**
0106      * Create a new chain
0107      *
0108      * @param  Zend_Controller_Router_Route_Abstract $route
0109      * @param  string                                $separator
0110      * @return Zend_Controller_Router_Route_Chain
0111      */
0112     public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/')
0113     {
0114         // require_once 'Zend/Controller/Router/Route/Chain.php';
0115 
0116         $chain = new Zend_Controller_Router_Route_Chain();
0117         $chain->chain($this)->chain($route, $separator);
0118 
0119         return $chain;
0120     }
0121 }