diff --git a/src/Pecee/SimpleRouter/RouterEntry.php b/src/Pecee/SimpleRouter/RouterEntry.php index 1148725..3dffcb5 100644 --- a/src/Pecee/SimpleRouter/RouterEntry.php +++ b/src/Pecee/SimpleRouter/RouterEntry.php @@ -18,9 +18,13 @@ abstract class RouterEntry { protected $settings; protected $callback; + protected $parameters; + protected $parametersRegex; public function __construct() { $this->settings = array(); + $this->parameters = array(); + $this->parametersRegex = array(); } protected function loadClass($name) { @@ -116,6 +120,33 @@ abstract class RouterEntry { return $this->settings; } + /** + * @return mixed + */ + public function getParameters(){ + return $this->parameters; + } + + /** + * @param mixed $parameters + * @return self + */ + public function setParameters($parameters) { + $this->parameters = $parameters; + return $this; + } + + /** + * Add regular expression parameter match + * + * @param array $options + * @return self + */ + public function where(array $options) { + $this->parametersRegex = array_merge($this->parametersRegex, $options); + return $this; + } + /** * Get settings that are allowed to be inherited by child routes. * diff --git a/src/Pecee/SimpleRouter/RouterRoute.php b/src/Pecee/SimpleRouter/RouterRoute.php index 3944c25..580a94c 100644 --- a/src/Pecee/SimpleRouter/RouterRoute.php +++ b/src/Pecee/SimpleRouter/RouterRoute.php @@ -9,8 +9,6 @@ class RouterRoute extends RouterEntry { protected $url; protected $requestTypes; - protected $parameters; - protected $parametersRegex; public function __construct($url, $callback) { parent::__construct(); @@ -19,8 +17,6 @@ class RouterRoute extends RouterEntry { $this->settings['aliases'] = array(); $this->requestTypes = array(); - $this->parameters = array(); - $this->parametersRegex = array(); } protected function parseParameters($url) { @@ -178,31 +174,4 @@ class RouterRoute extends RouterEntry { public function getRequestTypes() { return $this->requestTypes; } - - /** - * @return mixed - */ - public function getParameters(){ - return $this->parameters; - } - - /** - * @param mixed $parameters - * @return self - */ - public function setParameters($parameters) { - $this->parameters = $parameters; - return $this; - } - - /** - * Add regular expression parameter match - * - * @param array $options - * @return self - */ - public function where(array $options) { - $this->parametersRegex = array_merge($this->parametersRegex, $options); - return $this; - } } \ No newline at end of file