From 9a656e5b35d004b55fbe09d10d51254a8ec4fd67 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 4 Feb 2022 11:13:50 +0100 Subject: Move calendar resource/room backend registration to IBootstrap Signed-off-by: Christoph Wurst --- .../AppFramework/Bootstrap/RegistrationContext.php | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'lib/private/AppFramework/Bootstrap') diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index 401a967c988..b40d3356d1a 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -30,6 +30,8 @@ declare(strict_types=1); namespace OC\AppFramework\Bootstrap; use Closure; +use OCP\Calendar\Resource\IBackend as IResourceBackend; +use OCP\Calendar\Room\IBackend as IRoomBackend; use OCP\Talk\ITalkBackend; use RuntimeException; use function array_shift; @@ -70,6 +72,12 @@ class RegistrationContext { /** @var null|ServiceRegistration */ private $talkBackendRegistration = null; + /** @var ServiceRegistration[] */ + private $calendarResourceBackendRegistrations = []; + + /** @var ServiceRegistration[] */ + private $calendarRoomBackendRegistrations = []; + /** @var ServiceFactoryRegistration[] */ private $services = []; @@ -271,6 +279,20 @@ class RegistrationContext { $backend ); } + + public function registerCalendarResourceBackend(string $class): void { + $this->context->registerCalendarResourceBackend( + $this->appId, + $class + ); + } + + public function registerCalendarRoomBackend(string $class): void { + $this->context->registerCalendarRoomBackend( + $this->appId, + $class + ); + } }; } @@ -376,6 +398,20 @@ class RegistrationContext { $this->talkBackendRegistration = new ServiceRegistration($appId, $backend); } + public function registerCalendarResourceBackend(string $appId, string $class) { + $this->calendarResourceBackendRegistrations[] = new ServiceRegistration( + $appId, + $class, + ); + } + + public function registerCalendarRoomBackend(string $appId, string $class) { + $this->calendarRoomBackendRegistrations[] = new ServiceRegistration( + $appId, + $class, + ); + } + /** * @param App[] $apps */ @@ -635,4 +671,20 @@ class RegistrationContext { public function getTalkBackendRegistration(): ?ServiceRegistration { return $this->talkBackendRegistration; } + + /** + * @return ServiceRegistration[] + * @psalm-return ServiceRegistration[] + */ + public function getCalendarResourceBackendRegistrations(): array { + return $this->calendarResourceBackendRegistrations; + } + + /** + * @return ServiceRegistration[] + * @psalm-return ServiceRegistration[] + */ + public function getCalendarRoomBackendRegistrations(): array { + return $this->calendarRoomBackendRegistrations; + } } -- cgit v1.2.3