Skip to content

Commit

Permalink
rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 27, 2020
1 parent 90a9cc1 commit 870efef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/Illuminate/Routing/RouteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ class RouteGroup
*
* @param array $new
* @param array $old
* @param bool $prefixOldFirst
* @param bool $prependExistingPrefix
* @return array
*/
public static function merge($new, $old, $prefixOldFirst = true)
public static function merge($new, $old, $prependExistingPrefix = true)
{
if (isset($new['domain'])) {
unset($old['domain']);
}

$new = array_merge(static::formatAs($new, $old), [
'namespace' => static::formatNamespace($new, $old),
'prefix' => static::formatPrefix($new, $old, $prefixOldFirst),
'prefix' => static::formatPrefix($new, $old, $prependExistingPrefix),
'where' => static::formatWhere($new, $old),
]);

Expand Down Expand Up @@ -54,14 +54,14 @@ protected static function formatNamespace($new, $old)
*
* @param array $new
* @param array $old
* @param bool $prefixOldFirst
* @param bool $prependExistingPrefix
* @return string|null
*/
protected static function formatPrefix($new, $old, $prefixOldFirst = true)
protected static function formatPrefix($new, $old, $prependExistingPrefix = true)
{
$old = $old['prefix'] ?? null;

if ($prefixOldFirst) {
if ($prependExistingPrefix) {
return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old;
} else {
return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old;
Expand Down
11 changes: 7 additions & 4 deletions src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ protected function updateGroupStack(array $attributes)
* Merge the given array with the last group stack.
*
* @param array $new
* @param bool $prefixOldFirst
* @param bool $prependExistingPrefix
* @return array
*/
public function mergeWithLastGroup($new, $prefixOldFirst = true)
public function mergeWithLastGroup($new, $prependExistingPrefix = true)
{
return RouteGroup::merge($new, end($this->groupStack), $prefixOldFirst);
return RouteGroup::merge($new, end($this->groupStack), $prependExistingPrefix);
}

/**
Expand Down Expand Up @@ -585,7 +585,10 @@ protected function addWhereClausesToRoute($route)
*/
protected function mergeGroupAttributesIntoRoute($route)
{
$route->setAction($this->mergeWithLastGroup($route->getAction(), false));
$route->setAction($this->mergeWithLastGroup(
$route->getAction(),
$prependExistingPrefix = false
));
}

/**
Expand Down

0 comments on commit 870efef

Please sign in to comment.