Skip to content

Commit

Permalink
Move local $requestForMatching variable initialization outside loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
timplunkett committed Aug 26, 2014
1 parent 3518d67 commit c151993
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ChainRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,14 @@ private function doMatch($url, Request $request = null)
{
$methodNotAllowed = null;

$requestForMatching = $request;
foreach ($this->all() as $router) {
try {
// the request/url match logic is the same as in Symfony/Component/HttpKernel/EventListener/RouterListener.php
// matching requests is more powerful than matching URLs only, so try that first
if ($router instanceof RequestMatcherInterface) {
if (null === $request) {
if (empty($requestForMatching)) {
$requestForMatching = Request::create($url);
} else {
$requestForMatching = $request;
}

return $router->matchRequest($requestForMatching);
Expand Down

0 comments on commit c151993

Please sign in to comment.