Abstract.php 2.8 KB

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