Skip to content

Commit

Permalink
refactor: move method calls to outside of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jan 24, 2022
1 parent 622d611 commit e77083c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions system/Commands/Utilities/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,20 @@ public function run(array $params)

private function getAutoRoutes(RouteCollection $collection): array
{
$defaultNamespace = $collection->getDefaultNamespace();
$finder = new ControllerFinder($defaultNamespace);
$reader = new ControllerMethodReader($defaultNamespace);
$defaultNamespace = $collection->getDefaultNamespace();
$defaultController = $collection->getDefaultController();
$defaultMethod = $collection->getDefaultMethod();

$finder = new ControllerFinder($defaultNamespace);
$reader = new ControllerMethodReader($defaultNamespace);

$tbody = [];

foreach ($finder->find() as $class) {
$output = $reader->read(
$class,
$collection->getDefaultController(),
$collection->getDefaultMethod()
$defaultController,
$defaultMethod
);

foreach ($output as $item) {
Expand Down

0 comments on commit e77083c

Please sign in to comment.