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:
@@ -4,8 +4,11 @@ namespace Pecee\SimpleRouter;
|
||||
|
||||
class RouterGroup extends RouterEntry {
|
||||
|
||||
protected $requestTypes;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->requestTypes = array();
|
||||
}
|
||||
|
||||
public function getRoute($requestMethod, &$url) {
|
||||
@@ -18,4 +21,27 @@ class RouterGroup extends RouterEntry {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user