diff --git a/src/App.php b/src/App.php index 68cae80830..e0f1a0e2da 100644 --- a/src/App.php +++ b/src/App.php @@ -715,7 +715,24 @@ class App /** @var Router $router */ $router = $this->container->create(Router::class); - return $router->getModule($this->container, $moduleClass); + $moduleClass = $moduleClass ?? $router->getModuleClass(); + $parameters = $router->getParameters(); + + $dice_profiler_threshold = $this->config->get('system', 'dice_profiler_threshold', 0); + + $stamp = microtime(true); + + /** @var ICanHandleRequests $module */ + $module = $this->container->create($moduleClass, $parameters); + + if ($dice_profiler_threshold > 0) { + $dur = floatval(microtime(true) - $stamp); + if ($dur >= $dice_profiler_threshold) { + $this->logger->notice('Dice module creation lasts too long.', ['duration' => round($dur, 3), 'module' => $moduleClass, 'parameters' => $parameters]); + } + } + + return $module; } /** diff --git a/src/App/Router.php b/src/App/Router.php index f1f0510867..deb0155cf0 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -319,25 +319,9 @@ class Router } } - public function getModule(Dice $dice, ?string $module_class = null): ICanHandleRequests + public function getParameters(): array { - $moduleClass = $module_class ?? $this->getModuleClass(); - - $dice_profiler_threshold = $this->config->get('system', 'dice_profiler_threshold', 0); - - $stamp = microtime(true); - - /** @var ICanHandleRequests $module */ - $module = $dice->create($moduleClass, $this->parameters); - - if ($dice_profiler_threshold > 0) { - $dur = floatval(microtime(true) - $stamp); - if ($dur >= $dice_profiler_threshold) { - $this->logger->notice('Dice module creation lasts too long.', ['duration' => round($dur, 3), 'module' => $moduleClass, 'parameters' => $this->parameters]); - } - } - - return $module; + return $this->parameters; } /**