Skip to content
Browse files

Add a small optimization for reverse routing.

There is no reason to check the routes of a collection if the scope
parameters don't intersect with the URL parameters.
  • Loading branch information...
markstory committed Jun 29, 2014
1 parent 41a97c2 commit 7ce2f4526e894d31881f4a5533f6b26a6439a510
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/Routing/Router.php
@@ -826,6 +826,11 @@ protected static function _match($url) {
// No quick win, iterate and hope for the best.
foreach (static::$_pathScopes as $key => $collection) {
$params = $collection->params();
// No point in checking the routes if the scope params are wrong.
if (array_intersect_key($url, $params) !== $params) {
$match = $collection->match($url, static::$_requestContext);
if ($match !== false) {
return $match;

0 comments on commit 7ce2f45

Please sign in to comment.
You can’t perform that action at this time.