1
0
mirror of https://github.com/dannyvankooten/AltoRouter.git synced 2025-08-10 18:35:20 +02:00

Use stripos to compare request method, instead of explode + in_array.

This commit is contained in:
Danny van Kooten
2015-11-03 08:13:51 +07:00
parent b0d115431e
commit 6fe6f4b196

View File

@@ -189,18 +189,9 @@ class AltoRouter {
}
foreach($this->routes as $handler) {
list($method, $_route, $target, $name) = $handler;
list($methods, $_route, $target, $name) = $handler;
$methods = explode('|', $method);
$method_match = false;
// Check if request method matches. If not, abandon early. (CHEAP)
foreach($methods as $method) {
if (strcasecmp($requestMethod, $method) === 0) {
$method_match = true;
break;
}
}
$method_match = (stripos($methods, $requestMethod) !== false);
// Method did not match, continue to next route.
if(!$method_match) continue;