diff options
Diffstat (limited to 'lib/private/AppFramework/Http/Dispatcher.php')
-rw-r--r-- | lib/private/AppFramework/Http/Dispatcher.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index aaaf2ba6560..cc288edc966 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -42,6 +42,7 @@ use OCP\AppFramework\Http\Response; use OCP\Diagnostics\IEventLogger; use OCP\IConfig; use OCP\IRequest; +use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; /** @@ -73,6 +74,8 @@ class Dispatcher { /** @var IEventLogger */ private $eventLogger; + private ContainerInterface $appContainer; + /** * @param Http $protocol the http protocol with contains all status headers * @param MiddlewareDispatcher $middlewareDispatcher the dispatcher which @@ -92,7 +95,8 @@ class Dispatcher { IConfig $config, ConnectionAdapter $connection, LoggerInterface $logger, - IEventLogger $eventLogger) { + IEventLogger $eventLogger, + ContainerInterface $appContainer) { $this->protocol = $protocol; $this->middlewareDispatcher = $middlewareDispatcher; $this->reflector = $reflector; @@ -101,6 +105,7 @@ class Dispatcher { $this->connection = $connection; $this->logger = $logger; $this->eventLogger = $eventLogger; + $this->appContainer = $appContainer; } @@ -216,6 +221,8 @@ class Dispatcher { $value = false; } elseif ($value !== null && \in_array($type, $types, true)) { settype($value, $type); + } elseif ($value === null && $type !== null && $this->appContainer->has($type)) { + $value = $this->appContainer->get($type); } $arguments[] = $value; |