Abstract.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. * @package Zend_Controller
  16. * @subpackage Router
  17. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @version $Id: Route.php 1847 2006-11-23 11:36:41Z martel $
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Controller_Router_Route_Interface
  23. */
  24. require_once 'Zend/Controller/Router/Route/Interface.php';
  25. /**
  26. * Abstract Route
  27. *
  28. * Implements interface and provides convenience methods
  29. *
  30. * @package Zend_Controller
  31. * @subpackage Router
  32. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_Router_Route_Interface
  36. {
  37. /**
  38. * Wether this route is abstract or not
  39. *
  40. * @var boolean
  41. */
  42. protected $_isAbstract = false;
  43. /**
  44. * Path matched by this route
  45. *
  46. * @var string
  47. */
  48. protected $_matchedPath = null;
  49. /**
  50. * Get the version of the route
  51. *
  52. * @return integer
  53. */
  54. public function getVersion()
  55. {
  56. return 2;
  57. }
  58. /**
  59. * Set partially matched path
  60. *
  61. * @param string $path
  62. * @return void
  63. */
  64. public function setMatchedPath($path)
  65. {
  66. $this->_matchedPath = $path;
  67. }
  68. /**
  69. * Get partially matched path
  70. *
  71. * @return string
  72. */
  73. public function getMatchedPath()
  74. {
  75. return $this->_matchedPath;
  76. }
  77. /**
  78. * Check or set wether this is an abstract route or not
  79. *
  80. * @param boolean $flag
  81. * @return boolean
  82. */
  83. public function isAbstract($flag = null)
  84. {
  85. if ($flag !== null) {
  86. $this->_isAbstract = $flag;
  87. }
  88. return $this->_isAbstract;
  89. }
  90. /**
  91. * Create a new chain
  92. *
  93. * @param Zend_Controller_Router_Route_Abstract $route
  94. * @param string $separator
  95. * @return Zend_Controller_Router_Route_Chain
  96. */
  97. public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/')
  98. {
  99. require_once 'Zend/Controller/Router/Route/Chain.php';
  100. $chain = new Zend_Controller_Router_Route_Chain();
  101. $chain->chain($this)->chain($route, $separator);
  102. return $chain;
  103. }
  104. }