Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 3382fa1

Browse files
authored
Merge pull request #13 from modulusphp/feature/route-list
Refactor: removed defaults
2 parents c88f678 + 187044c commit 3382fa1

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

Commands/RouteList.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
4545
$routes = array();
4646

4747
foreach (Route::$routes as $key => $route) {
48-
if ($route['file'] == 'web.php') {
49-
$defaults = 'web';
50-
}
51-
else if ($route['file'] == 'api.php') {
52-
$defaults = 'api';
53-
}
54-
else {
55-
$defaults = '';
56-
}
57-
5848
if ($method == 'all') {
59-
$middleware = $defaults . (count($route['middleware']) > 0 ? '|' : '') . implode('|', $route['middleware']);
49+
$middleware = implode('|', $route['middleware']);
6050
array_push($routes, array(implode(',', $route['method']), $route['pattern'], $route['name'], is_string($route['callback']) ? $route['callback'] : '<comment>Closure</comment>', $middleware));
6151
} else if (str_contains(implode(' ', $route['method']), $method)) {
62-
$middleware = $defaults . (count($route['middleware']) > 0 ? '|' : '') . implode('|', $route['middleware']);
52+
$middleware = implode('|', $route['middleware']);
6353
array_push($routes, array(implode(',', $route['method']), $route['pattern'], $route['name'], is_string($route['callback']) ? $route['callback'] : '<comment>Closure</comment>', $middleware));
6454
}
6555
}

0 commit comments

Comments
 (0)