mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
[BUGFIX] Bugfixes.
- Fixed not validating domain on - Other small changes.
This commit is contained in:
@@ -133,6 +133,12 @@ class RouterBase {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($route->getGroup() !== null) {
|
||||
if($route->getGroup()->matchDomain($this->request) === false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$routeNotAllowed = false;
|
||||
|
||||
$this->loadedRoute = $route;
|
||||
|
||||
@@ -10,7 +10,7 @@ class RouterGroup extends RouterEntry {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function matchDomain(Request $request) {
|
||||
public function matchDomain(Request $request) {
|
||||
if($this->domain !== null) {
|
||||
|
||||
if(is_array($this->domain)) {
|
||||
|
||||
@@ -90,6 +90,18 @@ class SimpleRouter {
|
||||
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) {
|
||||
$route = new RouterRoute($url, $callback);
|
||||
$route->setRequestMethods($requestMethods);
|
||||
|
||||
Reference in New Issue
Block a user