web/lib/Zend/Controller/Router/Route/Abstract.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Controller
       
    17  * @subpackage Router
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @version    $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    21  */
       
    22 
       
    23 /**
       
    24  * @see Zend_Controller_Router_Route_Interface
       
    25  */
       
    26 require_once 'Zend/Controller/Router/Route/Interface.php';
       
    27 
       
    28 /**
       
    29  * Abstract Route
       
    30  *
       
    31  * Implements interface and provides convenience methods
       
    32  *
       
    33  * @package    Zend_Controller
       
    34  * @subpackage Router
       
    35  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    36  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    37  */
       
    38 abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_Router_Route_Interface
       
    39 {
       
    40     /**
       
    41      * Wether this route is abstract or not
       
    42      *
       
    43      * @var boolean
       
    44      */
       
    45     protected $_isAbstract = false;
       
    46 
       
    47     /**
       
    48      * Path matched by this route
       
    49      *
       
    50      * @var string
       
    51      */
       
    52     protected $_matchedPath = null;
       
    53 
       
    54     /**
       
    55      * Get the version of the route
       
    56      *
       
    57      * @return integer
       
    58      */
       
    59     public function getVersion()
       
    60     {
       
    61         return 2;
       
    62     }
       
    63 
       
    64     /**
       
    65      * Set partially matched path
       
    66      *
       
    67      * @param  string $path
       
    68      * @return void
       
    69      */
       
    70     public function setMatchedPath($path)
       
    71     {
       
    72         $this->_matchedPath = $path;
       
    73     }
       
    74 
       
    75     /**
       
    76      * Get partially matched path
       
    77      *
       
    78      * @return string
       
    79      */
       
    80     public function getMatchedPath()
       
    81     {
       
    82         return $this->_matchedPath;
       
    83     }
       
    84 
       
    85     /**
       
    86      * Check or set wether this is an abstract route or not
       
    87      *
       
    88      * @param  boolean $flag
       
    89      * @return boolean
       
    90      */
       
    91     public function isAbstract($flag = null)
       
    92     {
       
    93         if ($flag !== null) {
       
    94             $this->_isAbstract = $flag;
       
    95         }
       
    96 
       
    97         return $this->_isAbstract;
       
    98     }
       
    99 
       
   100     /**
       
   101      * Create a new chain
       
   102      *
       
   103      * @param  Zend_Controller_Router_Route_Abstract $route
       
   104      * @param  string                                $separator
       
   105      * @return Zend_Controller_Router_Route_Chain
       
   106      */
       
   107     public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/')
       
   108     {
       
   109         require_once 'Zend/Controller/Router/Route/Chain.php';
       
   110 
       
   111         $chain = new Zend_Controller_Router_Route_Chain();
       
   112         $chain->chain($this)->chain($route, $separator);
       
   113 
       
   114         return $chain;
       
   115     }
       
   116 
       
   117 }