[Routing] Small optimization in the UrlMatcher

This commit is contained in:
Victor Berchet 2012-02-07 17:52:32 +01:00
parent abc2141d5b
commit 4fcf9efe65

View File

@ -80,7 +80,7 @@ class UrlMatcher implements UrlMatcherInterface
{
$this->allow = array();
if ($ret = $this->matchCollection($pathinfo, $this->routes)) {
if ($ret = $this->matchCollection(urldecode($pathinfo), $this->routes)) {
return $ret;
}
@ -102,8 +102,6 @@ class UrlMatcher implements UrlMatcherInterface
*/
protected function matchCollection($pathinfo, RouteCollection $routes)
{
$pathinfo = urldecode($pathinfo);
foreach ($routes as $name => $route) {
if ($route instanceof RouteCollection) {
if (false === strpos($route->getPrefix(), '{') && $route->getPrefix() !== substr($pathinfo, 0, strlen($route->getPrefix()))) {