mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[TASK] Moved parameter stuff to RouterEntry class.
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user