@@ 515-526 (lines=12) @@ | ||
512 | }); |
|
513 | ||
514 | if (empty(static::$optimized_tree)) { |
|
515 | foreach ((array)static::$routes as $group => $routes){ |
|
516 | foreach ($routes as $route) { |
|
517 | if (is_a($route, 'Route') && $route->match($URL,$method)){ |
|
518 | if ($return_route){ |
|
519 | return $route; |
|
520 | } else { |
|
521 | $route->run($route->extractArgs($URL),$method); |
|
522 | return true; |
|
523 | } |
|
524 | } |
|
525 | } |
|
526 | } |
|
527 | } else { |
|
528 | $routes =& static::$optimized_tree; |
|
529 | foreach (explode('/',trim($URL,'/')) as $segment) { |
|
@@ 535-544 (lines=10) @@ | ||
532 | else if (isset($routes[''])) $routes =& $routes['']; |
|
533 | else break; |
|
534 | } |
|
535 | if (isset($routes[0]) && !is_array($routes[0])) foreach ((array)$routes as $route) { |
|
536 | if ($route->match($URL, $method)){ |
|
537 | if ($return_route){ |
|
538 | return $route; |
|
539 | } else { |
|
540 | $route->run($route->extractArgs($URL),$method); |
|
541 | return true; |
|
542 | } |
|
543 | } |
|
544 | } |
|
545 | } |
|
546 | ||
547 | Response::status(404, '404 Resource not found.'); |