Skip to content

Commit 12c79f6

Browse files
committed
refactor: rename parameter and variable name
1 parent 1c1cfb0 commit 12c79f6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

system/Router/RouteCollection.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,8 +1078,8 @@ public function reverseRoute(string $search, ...$params)
10781078
// all routes to find a match.
10791079
foreach ($this->routes as $collection) {
10801080
foreach ($collection as $route) {
1081-
$from = key($route['route']);
1082-
$to = $route['route'][$from];
1081+
$routeKey = key($route['route']);
1082+
$to = $route['route'][$routeKey];
10831083

10841084
// ignore closures
10851085
if (! is_string($to)) {
@@ -1103,7 +1103,7 @@ public function reverseRoute(string $search, ...$params)
11031103
continue;
11041104
}
11051105

1106-
return $this->buildReverseRoute($from, $params);
1106+
return $this->buildReverseRoute($routeKey, $params);
11071107
}
11081108
}
11091109

@@ -1218,21 +1218,21 @@ protected function fillRouteParams(string $from, ?array $params = null): string
12181218
* @param array $params One or more parameters to be passed to the route.
12191219
* The last parameter allows you to set the locale.
12201220
*/
1221-
protected function buildReverseRoute(string $from, array $params): string
1221+
protected function buildReverseRoute(string $routeKey, array $params): string
12221222
{
12231223
$locale = null;
12241224

12251225
// Find all of our back-references in the original route
1226-
preg_match_all('/\(([^)]+)\)/', $from, $matches);
1226+
preg_match_all('/\(([^)]+)\)/', $routeKey, $matches);
12271227

12281228
if (empty($matches[0])) {
1229-
if (strpos($from, '{locale}') !== false) {
1229+
if (strpos($routeKey, '{locale}') !== false) {
12301230
$locale = $params[0] ?? null;
12311231
}
12321232

1233-
$from = $this->replaceLocale($from, $locale);
1233+
$routeKey = $this->replaceLocale($routeKey, $locale);
12341234

1235-
return '/' . ltrim($from, '/');
1235+
return '/' . ltrim($routeKey, '/');
12361236
}
12371237

12381238
// Locale is passed?
@@ -1250,13 +1250,13 @@ protected function buildReverseRoute(string $from, array $params): string
12501250

12511251
// Ensure that the param we're inserting matches
12521252
// the expected param type.
1253-
$pos = strpos($from, $pattern);
1254-
$from = substr_replace($from, $params[$index], $pos, strlen($pattern));
1253+
$pos = strpos($routeKey, $pattern);
1254+
$routeKey = substr_replace($routeKey, $params[$index], $pos, strlen($pattern));
12551255
}
12561256

1257-
$from = $this->replaceLocale($from, $locale);
1257+
$routeKey = $this->replaceLocale($routeKey, $locale);
12581258

1259-
return '/' . ltrim($from, '/');
1259+
return '/' . ltrim($routeKey, '/');
12601260
}
12611261

12621262
/**

0 commit comments

Comments
 (0)