various refactoring and tweaks.

This commit is contained in:
Taylor Otwell
2011-10-20 21:44:18 -05:00
parent df9130dafa
commit af36cb3d5a
22 changed files with 140 additions and 110 deletions

View File

@@ -153,7 +153,10 @@ class Router {
foreach (explode(', ', $keys) as $key)
{
// Append the provided formats to the route as an optional regular expression.
if ( ! is_null($formats = $this->provides($callback))) $key .= '(\.('.implode('|', $formats).'))?';
if ( ! is_null($formats = $this->provides($callback)))
{
$key .= '(\.('.implode('|', $formats).'))?';
}
if (preg_match('#^'.$this->wildcards($key).'$#', $destination))
{
@@ -216,7 +219,9 @@ class Router {
{
foreach (array_reverse($segments, true) as $key => $value)
{
if (file_exists($path = $this->controllers.implode('/', array_slice($segments, 0, $key + 1)).EXT))
$controller = implode('/', array_slice($segments, 0, $key + 1)).EXT;
if (file_exists($path = $this->controllers.$controller))
{
return $key + 1;
}