mirror of
https://github.com/friendica/friendica
synced 2025-04-30 15:04:23 +02:00
remove constructor injection of Dice in Router
This commit is contained in:
parent
182732b112
commit
fa315cf44a
3 changed files with 4 additions and 10 deletions
|
@ -715,7 +715,7 @@ class App
|
||||||
/** @var Router $router */
|
/** @var Router $router */
|
||||||
$router = $this->container->create(Router::class);
|
$router = $this->container->create(Router::class);
|
||||||
|
|
||||||
return $router->getModule($moduleClass);
|
return $router->getModule($this->container, $moduleClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -92,9 +92,6 @@ class Router
|
||||||
/** @var float */
|
/** @var float */
|
||||||
private $dice_profiler_threshold;
|
private $dice_profiler_threshold;
|
||||||
|
|
||||||
/** @var Dice */
|
|
||||||
private $dice;
|
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $baseRoutesFilepath;
|
private $baseRoutesFilepath;
|
||||||
|
|
||||||
|
@ -113,11 +110,10 @@ class Router
|
||||||
* @param IManageConfigValues $config
|
* @param IManageConfigValues $config
|
||||||
* @param Arguments $args
|
* @param Arguments $args
|
||||||
* @param LoggerInterface $logger
|
* @param LoggerInterface $logger
|
||||||
* @param Dice $dice
|
|
||||||
* @param IHandleUserSessions $userSession
|
* @param IHandleUserSessions $userSession
|
||||||
* @param RouteCollector|null $routeCollector
|
* @param RouteCollector|null $routeCollector
|
||||||
*/
|
*/
|
||||||
public function __construct(array $server, string $baseRoutesFilepath, L10n $l10n, ICanCache $cache, ICanLock $lock, IManageConfigValues $config, Arguments $args, LoggerInterface $logger, Dice $dice, IHandleUserSessions $userSession, RouteCollector $routeCollector = null)
|
public function __construct(array $server, string $baseRoutesFilepath, L10n $l10n, ICanCache $cache, ICanLock $lock, IManageConfigValues $config, Arguments $args, LoggerInterface $logger, IHandleUserSessions $userSession, RouteCollector $routeCollector = null)
|
||||||
{
|
{
|
||||||
$this->baseRoutesFilepath = $baseRoutesFilepath;
|
$this->baseRoutesFilepath = $baseRoutesFilepath;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
|
@ -125,7 +121,6 @@ class Router
|
||||||
$this->lock = $lock;
|
$this->lock = $lock;
|
||||||
$this->args = $args;
|
$this->args = $args;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->dice = $dice;
|
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->isLocalUser = !empty($userSession->getLocalUserId());
|
$this->isLocalUser = !empty($userSession->getLocalUserId());
|
||||||
|
@ -328,14 +323,14 @@ class Router
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getModule(?string $module_class = null): ICanHandleRequests
|
public function getModule(Dice $dice, ?string $module_class = null): ICanHandleRequests
|
||||||
{
|
{
|
||||||
$moduleClass = $module_class ?? $this->getModuleClass();
|
$moduleClass = $module_class ?? $this->getModuleClass();
|
||||||
|
|
||||||
$stamp = microtime(true);
|
$stamp = microtime(true);
|
||||||
|
|
||||||
/** @var ICanHandleRequests $module */
|
/** @var ICanHandleRequests $module */
|
||||||
$module = $this->dice->create($moduleClass, $this->parameters);
|
$module = $dice->create($moduleClass, $this->parameters);
|
||||||
|
|
||||||
if ($this->dice_profiler_threshold > 0) {
|
if ($this->dice_profiler_threshold > 0) {
|
||||||
$dur = floatval(microtime(true) - $stamp);
|
$dur = floatval(microtime(true) - $stamp);
|
||||||
|
|
|
@ -219,7 +219,6 @@ return (function(string $basepath, array $getVars, array $serverVars, array $coo
|
||||||
'constructParams' => [
|
'constructParams' => [
|
||||||
$serverVars,
|
$serverVars,
|
||||||
__DIR__ . '/routes.config.php',
|
__DIR__ . '/routes.config.php',
|
||||||
[Dice::INSTANCE => Dice::SELF],
|
|
||||||
null
|
null
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue