mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
@@ -133,6 +133,12 @@ class RouterBase {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($route->getGroup() !== null) {
|
||||||
|
if($route->getGroup()->matchDomain($this->request) === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$routeNotAllowed = false;
|
$routeNotAllowed = false;
|
||||||
|
|
||||||
$this->loadedRoute = $route;
|
$this->loadedRoute = $route;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class RouterGroup extends RouterEntry {
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function matchDomain(Request $request) {
|
public function matchDomain(Request $request) {
|
||||||
if($this->domain !== null) {
|
if($this->domain !== null) {
|
||||||
|
|
||||||
if(is_array($this->domain)) {
|
if(is_array($this->domain)) {
|
||||||
|
|||||||
@@ -90,6 +90,18 @@ class SimpleRouter {
|
|||||||
return $group;
|
return $group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds get + post route
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
* @param function $callback
|
||||||
|
* @param array|null $settings
|
||||||
|
* @return RouterRoute
|
||||||
|
*/
|
||||||
|
public static function basic($url, $callback, array $settings = null) {
|
||||||
|
return self::match(['get', 'post'], $url, $callback, $settings);
|
||||||
|
}
|
||||||
|
|
||||||
public static function match(array $requestMethods, $url, $callback, array $settings = null) {
|
public static function match(array $requestMethods, $url, $callback, array $settings = null) {
|
||||||
$route = new RouterRoute($url, $callback);
|
$route = new RouterRoute($url, $callback);
|
||||||
$route->setRequestMethods($requestMethods);
|
$route->setRequestMethods($requestMethods);
|
||||||
|
|||||||
Reference in New Issue
Block a user