Replaced for loops by foreach

This commit is contained in:
Juan Basso 2014-10-20 16:35:53 -04:00
parent 6b723b9327
commit 833ca68a55

View file

@ -610,11 +610,9 @@ class Router {
extract(self::_parseExtension($url));
for ($i = 0, $len = count(self::$routes); $i < $len; $i++) {
$route =& self::$routes[$i];
foreach (self::$routes as $route) {
if (($r = $route->parse($url)) !== false) {
self::$_currentRoute[] =& $route;
self::$_currentRoute[] = $route;
$out = $r;
break;
}
@ -906,12 +904,12 @@ class Router {
$match = false;
for ($i = 0, $len = count(self::$routes); $i < $len; $i++) {
foreach (self::$routes as $route) {
$originalUrl = $url;
$url = self::$routes[$i]->persistParams($url, $params);
$url = $route->persistParams($url, $params);
if ($match = self::$routes[$i]->match($url)) {
if ($match = $route->match($url)) {
$output = trim($match, '/');
break;
}
@ -995,12 +993,10 @@ class Router {
);
$keys = array_values(array_diff(array_keys($url), $skip));
$count = count($keys);
// Remove this once parsed URL parameters can be inserted into 'pass'
for ($i = 0; $i < $count; $i++) {
$key = $keys[$i];
if (is_numeric($keys[$i])) {
foreach ($keys as $key) {
if (is_numeric($key)) {
$args[] = $url[$key];
} else {
$named[$key] = $url[$key];