Skip to content

Commit a18c2f0

Browse files
committed
refactor: extract action to local variable
Address review feedback: avoid repeating $route->action['uses'] ?? ''
1 parent 35e5c4d commit a18c2f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Http/Controllers/Api.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ public function getRoutes()
2828
$routeMiddleware = [$routeMiddleware];
2929
}
3030

31+
$action = $route->action['uses'] ?? '';
32+
3133
return [
3234
'uri' => $route->uri,
3335
'as' => $routeName,
3436
'methods' => $route->methods,
35-
'action' => is_string($route->action['uses'] ?? '') ? ($route->action['uses'] ?? '') : 'Closure',
37+
'action' => is_string($action) ? $action : 'Closure',
3638
'middleware' => $routeMiddleware,
3739
];
3840
})->values()->all();

0 commit comments

Comments
 (0)