Skip to content

Commit

Permalink
reverse routing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjgreen committed Oct 21, 2014
1 parent 9017913 commit 1c357d7
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/Phroute/RouteCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,18 @@ public function route($name, array $args = null)
{
$url[] = $part['value'];
}
else
elseif(isset($replacements[$variable]))
{
if(isset($replacements[$variable]))
if($part['optional'])
{
if($part['optional'])
{
$url[] = '/';
}

$url[] = $replacements[$variable];
}
elseif(!$part['optional'])
{
throw new BadRouteException("Expecting route variable '{$part['name']}'");
$url[] = '/';
}

$variable++;
$url[] = $replacements[$variable++];
}
elseif(!$part['optional'])
{
throw new BadRouteException("Expecting route variable '{$part['name']}'");
}
}

Expand Down

0 comments on commit 1c357d7

Please sign in to comment.