| @@ 435-440 (lines=6) @@ | ||
| 432 | ||
| 433 | if (empty(static::$optimized_tree)) { |
|
| 434 | foreach ((array)static::$routes as $group => $routes){ |
|
| 435 | foreach ($routes as $route) { |
|
| 436 | if (is_a($route, 'Route') && false !== ($args = $route->match($URL,$method))){ |
|
| 437 | $route->run($args,$method); |
|
| 438 | return true; |
|
| 439 | } |
|
| 440 | } |
|
| 441 | } |
|
| 442 | } else { |
|
| 443 | $routes =& static::$optimized_tree; |
|
| @@ 447-452 (lines=6) @@ | ||
| 444 | foreach (explode('/',trim($URL,'/')) as $segment) { |
|
| 445 | if (isset($routes[$segment])) $routes =& $routes[$segment]; |
|
| 446 | } |
|
| 447 | if (isset($routes[0]) && !is_array($routes[0])) foreach ((array)$routes as $route) { |
|
| 448 | if (false !== ($args = $route->match($URL, $method))){ |
|
| 449 | $route->run($args, $method); |
|
| 450 | return true; |
|
| 451 | } |
|
| 452 | } |
|
| 453 | } |
|
| 454 | ||
| 455 | Response::status(404, '404 Resource not found.'); |
|