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 25, 2022
1 parent 1a9ee9c commit 02c4d19
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 02c4d19

Please sign in to comment.