mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 16:57:53 +00:00
[OPTIMISATION] Optimised middleware loading and routes.
This commit is contained in:
@@ -179,9 +179,9 @@ abstract class RouterEntry {
|
|||||||
public function getMergeableSettings() {
|
public function getMergeableSettings() {
|
||||||
$settings = $this->settings;
|
$settings = $this->settings;
|
||||||
|
|
||||||
if(isset($settings['middleware'])) {
|
/*if(isset($settings['middleware'])) {
|
||||||
unset($settings['middleware']);
|
unset($settings['middleware']);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if(isset($settings['prefix'])) {
|
if(isset($settings['prefix'])) {
|
||||||
unset($settings['prefix']);
|
unset($settings['prefix']);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class RouterGroup extends RouterEntry {
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function matchRoute(Request $request) {
|
public function renderRoute(Request $request) {
|
||||||
// Check if request method is allowed
|
// Check if request method is allowed
|
||||||
|
|
||||||
if(strtolower($request->getUri()) == strtolower($this->prefix) || stripos($request->getUri(), $this->prefix) === 0) {
|
if(strtolower($request->getUri()) == strtolower($this->prefix) || stripos($request->getUri(), $this->prefix) === 0) {
|
||||||
@@ -29,11 +29,17 @@ class RouterGroup extends RouterEntry {
|
|||||||
throw new RouterException('Method not allowed');
|
throw new RouterException('Method not allowed');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
$this->loadMiddleware($request);
|
||||||
|
|
||||||
|
return parent::renderRoute($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No match here, move on...
|
// No match here, move on...
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function matchRoute(Request $request) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user