[FEATURE]

- Added RouterController class.
- Added Router::controller functionality to SimpleRouter class.
- Bugfixes and optimisations.
This commit is contained in:
Simon Sessingø
2015-09-22 13:39:17 +02:00
parent 6b8ab11f28
commit 67c3479a3e
6 changed files with 223 additions and 35 deletions
-25
View File
@@ -17,13 +17,11 @@ abstract class RouterEntry {
);
protected $settings;
protected $requestTypes;
protected $callback;
protected $parameters;
public function __construct() {
$this->settings = array();
$this->requestTypes = array();
$this->parameters = array();
}
@@ -43,29 +41,6 @@ abstract class RouterEntry {
return $this->callback;
}
/**
* Add request type
*
* @param $type
* @return self
* @throws RouterException
*/
public function addRequestType($type) {
if(!in_array($type, self::$allowedRequestTypes)) {
throw new RouterException('Invalid request method: ' . $type);
}
$this->requestTypes[] = $type;
return $this;
}
/**
* @return mixed
*/
public function getRequestTypes() {
return $this->requestTypes;
}
/**
* @return mixed
*/