Merge pull request #55 from skipperbent/development

[BUGFIX] Bugfixes.
This commit is contained in:
Simon Sessingø
2015-12-19 18:09:08 +01:00
3 changed files with 19 additions and 1 deletions
+6
View File
@@ -133,6 +133,12 @@ class RouterBase {
continue;
}
if($route->getGroup() !== null) {
if($route->getGroup()->matchDomain($this->request) === false) {
continue;
}
}
$routeNotAllowed = false;
$this->loadedRoute = $route;
+1 -1
View File
@@ -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)) {
+12
View File
@@ -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);