mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[FEATURE]
- Added RouterController class. - Added Router::controller functionality to SimpleRouter class. - Bugfixes and optimisations.
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user