| @@ 449-454 (lines=6) @@ | ||
| 446 | ||
| 447 | if (empty(static::$optimized_tree)) { |
|
| 448 | foreach ((array)static::$routes as $group => $routes){ |
|
| 449 | foreach ($routes as $route) { |
|
| 450 | if (is_a($route, 'Route') && false !== ($args = $route->match($URL,$method))){ |
|
| 451 | $route->run($args,$method); |
|
| 452 | return true; |
|
| 453 | } |
|
| 454 | } |
|
| 455 | } |
|
| 456 | } else { |
|
| 457 | $routes =& static::$optimized_tree; |
|
| @@ 461-466 (lines=6) @@ | ||
| 458 | foreach (explode('/',trim($URL,'/')) as $segment) { |
|
| 459 | if (isset($routes[$segment])) $routes =& $routes[$segment]; |
|
| 460 | } |
|
| 461 | if (isset($routes[0]) && !is_array($routes[0])) foreach ((array)$routes as $route) { |
|
| 462 | if (false !== ($args = $route->match($URL, $method))){ |
|
| 463 | $route->run($args, $method); |
|
| 464 | return true; |
|
| 465 | } |
|
| 466 | } |
|
| 467 | } |
|
| 468 | ||
| 469 | Response::status(404, '404 Resource not found.'); |
|