Skip to content

Commit

Permalink
use a collection
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 7, 2016
1 parent 0e1c090 commit cb2eb79
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/Illuminate/Foundation/Console/RouteListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,9 @@ protected function displayRoutes(array $routes)
*/
protected function getMiddleware($route)
{
$middlewares = $route->gatherMiddleware();

foreach ($middlewares as $i => $middleware) {
if ($middleware instanceof Closure) {
$middlewares[$i] = 'Closure';
}
}

return implode(',', $middlewares);
return collect($route->gatherMiddleware())->map(function ($middleware) {
return $middleware instanceof Closure ? 'Closure' : $middleware;
})->implode(',');
}

/**
Expand Down

0 comments on commit cb2eb79

Please sign in to comment.