mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
Replaced for loops by foreach
This commit is contained in:
parent
6b723b9327
commit
833ca68a55
1 changed files with 7 additions and 11 deletions
|
@ -610,11 +610,9 @@ class Router {
|
||||||
|
|
||||||
extract(self::_parseExtension($url));
|
extract(self::_parseExtension($url));
|
||||||
|
|
||||||
for ($i = 0, $len = count(self::$routes); $i < $len; $i++) {
|
foreach (self::$routes as $route) {
|
||||||
$route =& self::$routes[$i];
|
|
||||||
|
|
||||||
if (($r = $route->parse($url)) !== false) {
|
if (($r = $route->parse($url)) !== false) {
|
||||||
self::$_currentRoute[] =& $route;
|
self::$_currentRoute[] = $route;
|
||||||
$out = $r;
|
$out = $r;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -906,12 +904,12 @@ class Router {
|
||||||
|
|
||||||
$match = false;
|
$match = false;
|
||||||
|
|
||||||
for ($i = 0, $len = count(self::$routes); $i < $len; $i++) {
|
foreach (self::$routes as $route) {
|
||||||
$originalUrl = $url;
|
$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, '/');
|
$output = trim($match, '/');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -995,12 +993,10 @@ class Router {
|
||||||
);
|
);
|
||||||
|
|
||||||
$keys = array_values(array_diff(array_keys($url), $skip));
|
$keys = array_values(array_diff(array_keys($url), $skip));
|
||||||
$count = count($keys);
|
|
||||||
|
|
||||||
// Remove this once parsed URL parameters can be inserted into 'pass'
|
// Remove this once parsed URL parameters can be inserted into 'pass'
|
||||||
for ($i = 0; $i < $count; $i++) {
|
foreach ($keys as $key) {
|
||||||
$key = $keys[$i];
|
if (is_numeric($key)) {
|
||||||
if (is_numeric($keys[$i])) {
|
|
||||||
$args[] = $url[$key];
|
$args[] = $url[$key];
|
||||||
} else {
|
} else {
|
||||||
$named[$key] = $url[$key];
|
$named[$key] = $url[$key];
|
||||||
|
|
Loading…
Add table
Reference in a new issue