mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48: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));
|
||||
|
||||
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];
|
||||
|
|
Loading…
Add table
Reference in a new issue