diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-07-05 22:03:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-05 22:03:12 +0200 |
commit | d3d11cb826654d9c597443edb1d22d63521a2698 (patch) | |
tree | 457a0a7c9add6c677b2627f8505b203e76e5dc8f /apps/dav/lib | |
parent | 52af709ceaf77b1f8b6b8f7b81dbbc115784f792 (diff) | |
parent | 9993a3b839a4354a2ccf67d4aac53922c2de9b54 (diff) | |
download | nextcloud-server-d3d11cb826654d9c597443edb1d22d63521a2698.tar.gz nextcloud-server-d3d11cb826654d9c597443edb1d22d63521a2698.zip |
Merge pull request #21626 from nextcloud/enhancement/injectible-callables
Callable parameter injection
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/AppInfo/Application.php | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index a0d75f5fe25..083bd8a474f 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -105,30 +105,14 @@ class Application extends App implements IBootstrap { // Load all dav apps \OC_App::loadApps(['dav']); - $this->registerHooks( - $context->getAppContainer()->query(HookManager::class), - $context->getServerContainer()->getEventDispatcher(), - $context->getAppContainer(), - $context->getServerContainer() - ); - $this->registerContactsManager( - $context->getAppContainer()->query(IContactsManager::class), - $context->getAppContainer() - ); - $this->registerCalendarManager( - $context->getAppContainer()->query(ICalendarManager::class), - $context->getAppContainer() - ); - $this->registerNotifier( - $context->getServerContainer()->getNotificationManager() - ); - $this->registerCalendarReminders( - $context->getAppContainer()->query(NotificationProviderManager::class), - $context->getAppContainer()->query(ILogger::class) - ); + $context->injectFn([$this, 'registerHooks']); + $context->injectFn([$this, 'registerContactsManager']); + $context->injectFn([$this, 'registerCalendarManager']); + $context->injectFn([$this, 'registerNotifier']); + $context->injectFn([$this, 'registerCalendarReminders']); } - private function registerHooks(HookManager $hm, + public function registerHooks(HookManager $hm, EventDispatcherInterface $dispatcher, IAppContainer $container, IServerContainer $serverContainer) { @@ -349,7 +333,7 @@ class Application extends App implements IBootstrap { $dispatcher->addListener('\OCP\Calendar\Room\ForceRefreshEvent', $eventHandler); } - private function registerContactsManager(IContactsManager $cm, IAppContainer $container): void { + public function registerContactsManager(IContactsManager $cm, IAppContainer $container): void { $cm->register(function () use ($container, $cm): void { $user = \OC::$server->getUserSession()->getUser(); if (!is_null($user)) { @@ -377,7 +361,7 @@ class Application extends App implements IBootstrap { $cm->setupSystemContactsProvider($contactsManager, $urlGenerator); } - private function registerCalendarManager(ICalendarManager $calendarManager, + public function registerCalendarManager(ICalendarManager $calendarManager, IAppContainer $container): void { $calendarManager->register(function () use ($container, $calendarManager) { $user = \OC::$server->getUserSession()->getUser(); @@ -394,11 +378,11 @@ class Application extends App implements IBootstrap { $cm->setupCalendarProvider($calendarManager, $userId); } - private function registerNotifier(INotificationManager $manager): void { + public function registerNotifier(INotificationManager $manager): void { $manager->registerNotifierService(Notifier::class); } - private function registerCalendarReminders(NotificationProviderManager $manager, + public function registerCalendarReminders(NotificationProviderManager $manager, ILogger $logger): void { try { $manager->registerProvider(AudioProvider::class); |