@@ -33,107 +33,107 @@ |
||
| 33 | 33 | use OCP\IServerContainer; |
| 34 | 34 | |
| 35 | 35 | class Manager implements IManager { |
| 36 | - private Coordinator $bootstrapCoordinator; |
|
| 37 | - |
|
| 38 | - private IServerContainer $server; |
|
| 39 | - |
|
| 40 | - private bool $bootstrapBackendsLoaded = false; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var string[] holds all registered resource backends |
|
| 44 | - * @psalm-var class-string<IBackend>[] |
|
| 45 | - */ |
|
| 46 | - private $backends = []; |
|
| 47 | - |
|
| 48 | - /** @var IBackend[] holds all backends that have been initialized already */ |
|
| 49 | - private $initializedBackends = []; |
|
| 50 | - |
|
| 51 | - public function __construct(Coordinator $bootstrapCoordinator, |
|
| 52 | - IServerContainer $server) { |
|
| 53 | - $this->bootstrapCoordinator = $bootstrapCoordinator; |
|
| 54 | - $this->server = $server; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Registers a resource backend |
|
| 59 | - * |
|
| 60 | - * @param string $backendClass |
|
| 61 | - * @return void |
|
| 62 | - * @since 14.0.0 |
|
| 63 | - */ |
|
| 64 | - public function registerBackend(string $backendClass) { |
|
| 65 | - $this->backends[$backendClass] = $backendClass; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Unregisters a resource backend |
|
| 70 | - * |
|
| 71 | - * @param string $backendClass |
|
| 72 | - * @return void |
|
| 73 | - * @since 14.0.0 |
|
| 74 | - */ |
|
| 75 | - public function unregisterBackend(string $backendClass) { |
|
| 76 | - unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - private function fetchBootstrapBackends(): void { |
|
| 80 | - if ($this->bootstrapBackendsLoaded) { |
|
| 81 | - return; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - $context = $this->bootstrapCoordinator->getRegistrationContext(); |
|
| 85 | - if ($context === null) { |
|
| 86 | - // Too soon |
|
| 87 | - return; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - foreach ($context->getCalendarResourceBackendRegistrations() as $registration) { |
|
| 91 | - $this->backends[] = $registration->getService(); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @return IBackend[] |
|
| 97 | - * @throws \OCP\AppFramework\QueryException |
|
| 98 | - * @since 14.0.0 |
|
| 99 | - */ |
|
| 100 | - public function getBackends():array { |
|
| 101 | - $this->fetchBootstrapBackends(); |
|
| 102 | - |
|
| 103 | - foreach ($this->backends as $backend) { |
|
| 104 | - if (isset($this->initializedBackends[$backend])) { |
|
| 105 | - continue; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - $this->initializedBackends[$backend] = $this->server->query($backend); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - return array_values($this->initializedBackends); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * @param string $backendId |
|
| 116 | - * @throws \OCP\AppFramework\QueryException |
|
| 117 | - * @return IBackend|null |
|
| 118 | - */ |
|
| 119 | - public function getBackend($backendId) { |
|
| 120 | - $backends = $this->getBackends(); |
|
| 121 | - foreach ($backends as $backend) { |
|
| 122 | - if ($backend->getBackendIdentifier() === $backendId) { |
|
| 123 | - return $backend; |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - return null; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * removes all registered backend instances |
|
| 132 | - * @return void |
|
| 133 | - * @since 14.0.0 |
|
| 134 | - */ |
|
| 135 | - public function clear() { |
|
| 136 | - $this->backends = []; |
|
| 137 | - $this->initializedBackends = []; |
|
| 138 | - } |
|
| 36 | + private Coordinator $bootstrapCoordinator; |
|
| 37 | + |
|
| 38 | + private IServerContainer $server; |
|
| 39 | + |
|
| 40 | + private bool $bootstrapBackendsLoaded = false; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var string[] holds all registered resource backends |
|
| 44 | + * @psalm-var class-string<IBackend>[] |
|
| 45 | + */ |
|
| 46 | + private $backends = []; |
|
| 47 | + |
|
| 48 | + /** @var IBackend[] holds all backends that have been initialized already */ |
|
| 49 | + private $initializedBackends = []; |
|
| 50 | + |
|
| 51 | + public function __construct(Coordinator $bootstrapCoordinator, |
|
| 52 | + IServerContainer $server) { |
|
| 53 | + $this->bootstrapCoordinator = $bootstrapCoordinator; |
|
| 54 | + $this->server = $server; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Registers a resource backend |
|
| 59 | + * |
|
| 60 | + * @param string $backendClass |
|
| 61 | + * @return void |
|
| 62 | + * @since 14.0.0 |
|
| 63 | + */ |
|
| 64 | + public function registerBackend(string $backendClass) { |
|
| 65 | + $this->backends[$backendClass] = $backendClass; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Unregisters a resource backend |
|
| 70 | + * |
|
| 71 | + * @param string $backendClass |
|
| 72 | + * @return void |
|
| 73 | + * @since 14.0.0 |
|
| 74 | + */ |
|
| 75 | + public function unregisterBackend(string $backendClass) { |
|
| 76 | + unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + private function fetchBootstrapBackends(): void { |
|
| 80 | + if ($this->bootstrapBackendsLoaded) { |
|
| 81 | + return; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + $context = $this->bootstrapCoordinator->getRegistrationContext(); |
|
| 85 | + if ($context === null) { |
|
| 86 | + // Too soon |
|
| 87 | + return; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + foreach ($context->getCalendarResourceBackendRegistrations() as $registration) { |
|
| 91 | + $this->backends[] = $registration->getService(); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @return IBackend[] |
|
| 97 | + * @throws \OCP\AppFramework\QueryException |
|
| 98 | + * @since 14.0.0 |
|
| 99 | + */ |
|
| 100 | + public function getBackends():array { |
|
| 101 | + $this->fetchBootstrapBackends(); |
|
| 102 | + |
|
| 103 | + foreach ($this->backends as $backend) { |
|
| 104 | + if (isset($this->initializedBackends[$backend])) { |
|
| 105 | + continue; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + $this->initializedBackends[$backend] = $this->server->query($backend); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + return array_values($this->initializedBackends); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * @param string $backendId |
|
| 116 | + * @throws \OCP\AppFramework\QueryException |
|
| 117 | + * @return IBackend|null |
|
| 118 | + */ |
|
| 119 | + public function getBackend($backendId) { |
|
| 120 | + $backends = $this->getBackends(); |
|
| 121 | + foreach ($backends as $backend) { |
|
| 122 | + if ($backend->getBackendIdentifier() === $backendId) { |
|
| 123 | + return $backend; |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + return null; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * removes all registered backend instances |
|
| 132 | + * @return void |
|
| 133 | + * @since 14.0.0 |
|
| 134 | + */ |
|
| 135 | + public function clear() { |
|
| 136 | + $this->backends = []; |
|
| 137 | + $this->initializedBackends = []; |
|
| 138 | + } |
|
| 139 | 139 | } |
@@ -33,113 +33,113 @@ |
||
| 33 | 33 | use OCP\IServerContainer; |
| 34 | 34 | |
| 35 | 35 | class Manager implements IManager { |
| 36 | - private Coordinator $bootstrapCoordinator; |
|
| 37 | - |
|
| 38 | - private IServerContainer $server; |
|
| 39 | - |
|
| 40 | - private bool $bootstrapBackendsLoaded = false; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var string[] holds all registered resource backends |
|
| 44 | - * @psalm-var class-string<IBackend>[] |
|
| 45 | - */ |
|
| 46 | - private array $backends = []; |
|
| 47 | - |
|
| 48 | - /** @var IBackend[] holds all backends that have been initialized already */ |
|
| 49 | - private array $initializedBackends = []; |
|
| 50 | - |
|
| 51 | - public function __construct(Coordinator $bootstrapCoordinator, |
|
| 52 | - IServerContainer $server) { |
|
| 53 | - $this->bootstrapCoordinator = $bootstrapCoordinator; |
|
| 54 | - $this->server = $server; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Registers a resource backend |
|
| 59 | - * |
|
| 60 | - * @param string $backendClass |
|
| 61 | - * @return void |
|
| 62 | - * @since 14.0.0 |
|
| 63 | - */ |
|
| 64 | - public function registerBackend(string $backendClass) { |
|
| 65 | - $this->backends[$backendClass] = $backendClass; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Unregisters a resource backend |
|
| 70 | - * |
|
| 71 | - * @param string $backendClass |
|
| 72 | - * @return void |
|
| 73 | - * @since 14.0.0 |
|
| 74 | - */ |
|
| 75 | - public function unregisterBackend(string $backendClass) { |
|
| 76 | - unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - private function fetchBootstrapBackends(): void { |
|
| 80 | - if ($this->bootstrapBackendsLoaded) { |
|
| 81 | - return; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - $context = $this->bootstrapCoordinator->getRegistrationContext(); |
|
| 85 | - if ($context === null) { |
|
| 86 | - // Too soon |
|
| 87 | - return; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - foreach ($context->getCalendarRoomBackendRegistrations() as $registration) { |
|
| 91 | - $this->backends[] = $registration->getService(); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @return IBackend[] |
|
| 97 | - * @throws \OCP\AppFramework\QueryException |
|
| 98 | - * @since 14.0.0 |
|
| 99 | - */ |
|
| 100 | - public function getBackends():array { |
|
| 101 | - $this->fetchBootstrapBackends(); |
|
| 102 | - |
|
| 103 | - foreach ($this->backends as $backend) { |
|
| 104 | - if (isset($this->initializedBackends[$backend])) { |
|
| 105 | - continue; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * @todo fetch from the app container |
|
| 110 | - * |
|
| 111 | - * The backend might have services injected that can't be build from the |
|
| 112 | - * server container. |
|
| 113 | - */ |
|
| 114 | - $this->initializedBackends[$backend] = $this->server->query($backend); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - return array_values($this->initializedBackends); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @param string $backendId |
|
| 122 | - * @throws \OCP\AppFramework\QueryException |
|
| 123 | - * @return IBackend|null |
|
| 124 | - */ |
|
| 125 | - public function getBackend($backendId) { |
|
| 126 | - $backends = $this->getBackends(); |
|
| 127 | - foreach ($backends as $backend) { |
|
| 128 | - if ($backend->getBackendIdentifier() === $backendId) { |
|
| 129 | - return $backend; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - return null; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * removes all registered backend instances |
|
| 138 | - * @return void |
|
| 139 | - * @since 14.0.0 |
|
| 140 | - */ |
|
| 141 | - public function clear() { |
|
| 142 | - $this->backends = []; |
|
| 143 | - $this->initializedBackends = []; |
|
| 144 | - } |
|
| 36 | + private Coordinator $bootstrapCoordinator; |
|
| 37 | + |
|
| 38 | + private IServerContainer $server; |
|
| 39 | + |
|
| 40 | + private bool $bootstrapBackendsLoaded = false; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var string[] holds all registered resource backends |
|
| 44 | + * @psalm-var class-string<IBackend>[] |
|
| 45 | + */ |
|
| 46 | + private array $backends = []; |
|
| 47 | + |
|
| 48 | + /** @var IBackend[] holds all backends that have been initialized already */ |
|
| 49 | + private array $initializedBackends = []; |
|
| 50 | + |
|
| 51 | + public function __construct(Coordinator $bootstrapCoordinator, |
|
| 52 | + IServerContainer $server) { |
|
| 53 | + $this->bootstrapCoordinator = $bootstrapCoordinator; |
|
| 54 | + $this->server = $server; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Registers a resource backend |
|
| 59 | + * |
|
| 60 | + * @param string $backendClass |
|
| 61 | + * @return void |
|
| 62 | + * @since 14.0.0 |
|
| 63 | + */ |
|
| 64 | + public function registerBackend(string $backendClass) { |
|
| 65 | + $this->backends[$backendClass] = $backendClass; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Unregisters a resource backend |
|
| 70 | + * |
|
| 71 | + * @param string $backendClass |
|
| 72 | + * @return void |
|
| 73 | + * @since 14.0.0 |
|
| 74 | + */ |
|
| 75 | + public function unregisterBackend(string $backendClass) { |
|
| 76 | + unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + private function fetchBootstrapBackends(): void { |
|
| 80 | + if ($this->bootstrapBackendsLoaded) { |
|
| 81 | + return; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + $context = $this->bootstrapCoordinator->getRegistrationContext(); |
|
| 85 | + if ($context === null) { |
|
| 86 | + // Too soon |
|
| 87 | + return; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + foreach ($context->getCalendarRoomBackendRegistrations() as $registration) { |
|
| 91 | + $this->backends[] = $registration->getService(); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @return IBackend[] |
|
| 97 | + * @throws \OCP\AppFramework\QueryException |
|
| 98 | + * @since 14.0.0 |
|
| 99 | + */ |
|
| 100 | + public function getBackends():array { |
|
| 101 | + $this->fetchBootstrapBackends(); |
|
| 102 | + |
|
| 103 | + foreach ($this->backends as $backend) { |
|
| 104 | + if (isset($this->initializedBackends[$backend])) { |
|
| 105 | + continue; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @todo fetch from the app container |
|
| 110 | + * |
|
| 111 | + * The backend might have services injected that can't be build from the |
|
| 112 | + * server container. |
|
| 113 | + */ |
|
| 114 | + $this->initializedBackends[$backend] = $this->server->query($backend); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + return array_values($this->initializedBackends); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @param string $backendId |
|
| 122 | + * @throws \OCP\AppFramework\QueryException |
|
| 123 | + * @return IBackend|null |
|
| 124 | + */ |
|
| 125 | + public function getBackend($backendId) { |
|
| 126 | + $backends = $this->getBackends(); |
|
| 127 | + foreach ($backends as $backend) { |
|
| 128 | + if ($backend->getBackendIdentifier() === $backendId) { |
|
| 129 | + return $backend; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + return null; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * removes all registered backend instances |
|
| 138 | + * @return void |
|
| 139 | + * @since 14.0.0 |
|
| 140 | + */ |
|
| 141 | + public function clear() { |
|
| 142 | + $this->backends = []; |
|
| 143 | + $this->initializedBackends = []; |
|
| 144 | + } |
|
| 145 | 145 | } |
@@ -57,634 +57,634 @@ |
||
| 57 | 57 | |
| 58 | 58 | class RegistrationContext { |
| 59 | 59 | |
| 60 | - /** @var ServiceRegistration<ICapability>[] */ |
|
| 61 | - private $capabilities = []; |
|
| 60 | + /** @var ServiceRegistration<ICapability>[] */ |
|
| 61 | + private $capabilities = []; |
|
| 62 | 62 | |
| 63 | - /** @var ServiceRegistration<IReporter>[] */ |
|
| 64 | - private $crashReporters = []; |
|
| 63 | + /** @var ServiceRegistration<IReporter>[] */ |
|
| 64 | + private $crashReporters = []; |
|
| 65 | 65 | |
| 66 | - /** @var ServiceRegistration<IWidget>[] */ |
|
| 67 | - private $dashboardPanels = []; |
|
| 66 | + /** @var ServiceRegistration<IWidget>[] */ |
|
| 67 | + private $dashboardPanels = []; |
|
| 68 | 68 | |
| 69 | - /** @var ServiceRegistration<ILinkAction>[] */ |
|
| 70 | - private $profileLinkActions = []; |
|
| 69 | + /** @var ServiceRegistration<ILinkAction>[] */ |
|
| 70 | + private $profileLinkActions = []; |
|
| 71 | 71 | |
| 72 | - /** @var null|ServiceRegistration<ITalkBackend> */ |
|
| 73 | - private $talkBackendRegistration = null; |
|
| 72 | + /** @var null|ServiceRegistration<ITalkBackend> */ |
|
| 73 | + private $talkBackendRegistration = null; |
|
| 74 | 74 | |
| 75 | - /** @var ServiceRegistration<IResourceBackend>[] */ |
|
| 76 | - private $calendarResourceBackendRegistrations = []; |
|
| 75 | + /** @var ServiceRegistration<IResourceBackend>[] */ |
|
| 76 | + private $calendarResourceBackendRegistrations = []; |
|
| 77 | 77 | |
| 78 | - /** @var ServiceRegistration<IRoomBackend>[] */ |
|
| 79 | - private $calendarRoomBackendRegistrations = []; |
|
| 78 | + /** @var ServiceRegistration<IRoomBackend>[] */ |
|
| 79 | + private $calendarRoomBackendRegistrations = []; |
|
| 80 | 80 | |
| 81 | - /** @var ServiceFactoryRegistration[] */ |
|
| 82 | - private $services = []; |
|
| 81 | + /** @var ServiceFactoryRegistration[] */ |
|
| 82 | + private $services = []; |
|
| 83 | 83 | |
| 84 | - /** @var ServiceAliasRegistration[] */ |
|
| 85 | - private $aliases = []; |
|
| 84 | + /** @var ServiceAliasRegistration[] */ |
|
| 85 | + private $aliases = []; |
|
| 86 | 86 | |
| 87 | - /** @var ParameterRegistration[] */ |
|
| 88 | - private $parameters = []; |
|
| 87 | + /** @var ParameterRegistration[] */ |
|
| 88 | + private $parameters = []; |
|
| 89 | 89 | |
| 90 | - /** @var EventListenerRegistration[] */ |
|
| 91 | - private $eventListeners = []; |
|
| 92 | - |
|
| 93 | - /** @var ServiceRegistration<Middleware>[] */ |
|
| 94 | - private $middlewares = []; |
|
| 95 | - |
|
| 96 | - /** @var ServiceRegistration<IProvider>[] */ |
|
| 97 | - private $searchProviders = []; |
|
| 98 | - |
|
| 99 | - /** @var ServiceRegistration<IAlternativeLogin>[] */ |
|
| 100 | - private $alternativeLogins = []; |
|
| 101 | - |
|
| 102 | - /** @var ServiceRegistration<InitialStateProvider>[] */ |
|
| 103 | - private $initialStates = []; |
|
| 104 | - |
|
| 105 | - /** @var ServiceRegistration<IHandler>[] */ |
|
| 106 | - private $wellKnownHandlers = []; |
|
| 107 | - |
|
| 108 | - /** @var ServiceRegistration<ICustomTemplateProvider>[] */ |
|
| 109 | - private $templateProviders = []; |
|
| 110 | - |
|
| 111 | - /** @var ServiceRegistration<INotifier>[] */ |
|
| 112 | - private $notifierServices = []; |
|
| 113 | - |
|
| 114 | - /** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */ |
|
| 115 | - private $twoFactorProviders = []; |
|
| 116 | - |
|
| 117 | - /** @var ServiceRegistration<ICalendarProvider>[] */ |
|
| 118 | - private $calendarProviders = []; |
|
| 119 | - |
|
| 120 | - /** @var LoggerInterface */ |
|
| 121 | - private $logger; |
|
| 122 | - |
|
| 123 | - /** @var PreviewProviderRegistration[] */ |
|
| 124 | - private $previewProviders = []; |
|
| 125 | - |
|
| 126 | - public function __construct(LoggerInterface $logger) { |
|
| 127 | - $this->logger = $logger; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - public function for(string $appId): IRegistrationContext { |
|
| 131 | - return new class($appId, $this) implements IRegistrationContext { |
|
| 132 | - /** @var string */ |
|
| 133 | - private $appId; |
|
| 134 | - |
|
| 135 | - /** @var RegistrationContext */ |
|
| 136 | - private $context; |
|
| 137 | - |
|
| 138 | - public function __construct(string $appId, RegistrationContext $context) { |
|
| 139 | - $this->appId = $appId; |
|
| 140 | - $this->context = $context; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - public function registerCapability(string $capability): void { |
|
| 144 | - $this->context->registerCapability( |
|
| 145 | - $this->appId, |
|
| 146 | - $capability |
|
| 147 | - ); |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - public function registerCrashReporter(string $reporterClass): void { |
|
| 151 | - $this->context->registerCrashReporter( |
|
| 152 | - $this->appId, |
|
| 153 | - $reporterClass |
|
| 154 | - ); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - public function registerDashboardWidget(string $widgetClass): void { |
|
| 158 | - $this->context->registerDashboardPanel( |
|
| 159 | - $this->appId, |
|
| 160 | - $widgetClass |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - public function registerService(string $name, callable $factory, bool $shared = true): void { |
|
| 165 | - $this->context->registerService( |
|
| 166 | - $this->appId, |
|
| 167 | - $name, |
|
| 168 | - $factory, |
|
| 169 | - $shared |
|
| 170 | - ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - public function registerServiceAlias(string $alias, string $target): void { |
|
| 174 | - $this->context->registerServiceAlias( |
|
| 175 | - $this->appId, |
|
| 176 | - $alias, |
|
| 177 | - $target |
|
| 178 | - ); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - public function registerParameter(string $name, $value): void { |
|
| 182 | - $this->context->registerParameter( |
|
| 183 | - $this->appId, |
|
| 184 | - $name, |
|
| 185 | - $value |
|
| 186 | - ); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - public function registerEventListener(string $event, string $listener, int $priority = 0): void { |
|
| 190 | - $this->context->registerEventListener( |
|
| 191 | - $this->appId, |
|
| 192 | - $event, |
|
| 193 | - $listener, |
|
| 194 | - $priority |
|
| 195 | - ); |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - public function registerMiddleware(string $class): void { |
|
| 199 | - $this->context->registerMiddleware( |
|
| 200 | - $this->appId, |
|
| 201 | - $class |
|
| 202 | - ); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - public function registerSearchProvider(string $class): void { |
|
| 206 | - $this->context->registerSearchProvider( |
|
| 207 | - $this->appId, |
|
| 208 | - $class |
|
| 209 | - ); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - public function registerAlternativeLogin(string $class): void { |
|
| 213 | - $this->context->registerAlternativeLogin( |
|
| 214 | - $this->appId, |
|
| 215 | - $class |
|
| 216 | - ); |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - public function registerInitialStateProvider(string $class): void { |
|
| 220 | - $this->context->registerInitialState( |
|
| 221 | - $this->appId, |
|
| 222 | - $class |
|
| 223 | - ); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - public function registerWellKnownHandler(string $class): void { |
|
| 227 | - $this->context->registerWellKnown( |
|
| 228 | - $this->appId, |
|
| 229 | - $class |
|
| 230 | - ); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - public function registerTemplateProvider(string $providerClass): void { |
|
| 234 | - $this->context->registerTemplateProvider( |
|
| 235 | - $this->appId, |
|
| 236 | - $providerClass |
|
| 237 | - ); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - public function registerNotifierService(string $notifierClass): void { |
|
| 241 | - $this->context->registerNotifierService( |
|
| 242 | - $this->appId, |
|
| 243 | - $notifierClass |
|
| 244 | - ); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - public function registerTwoFactorProvider(string $twoFactorProviderClass): void { |
|
| 248 | - $this->context->registerTwoFactorProvider( |
|
| 249 | - $this->appId, |
|
| 250 | - $twoFactorProviderClass |
|
| 251 | - ); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void { |
|
| 255 | - $this->context->registerPreviewProvider( |
|
| 256 | - $this->appId, |
|
| 257 | - $previewProviderClass, |
|
| 258 | - $mimeTypeRegex |
|
| 259 | - ); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - public function registerCalendarProvider(string $class): void { |
|
| 263 | - $this->context->registerCalendarProvider( |
|
| 264 | - $this->appId, |
|
| 265 | - $class |
|
| 266 | - ); |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - public function registerProfileLinkAction(string $actionClass): void { |
|
| 270 | - $this->context->registerProfileLinkAction( |
|
| 271 | - $this->appId, |
|
| 272 | - $actionClass |
|
| 273 | - ); |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - public function registerTalkBackend(string $backend): void { |
|
| 277 | - $this->context->registerTalkBackend( |
|
| 278 | - $this->appId, |
|
| 279 | - $backend |
|
| 280 | - ); |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - public function registerCalendarResourceBackend(string $class): void { |
|
| 284 | - $this->context->registerCalendarResourceBackend( |
|
| 285 | - $this->appId, |
|
| 286 | - $class |
|
| 287 | - ); |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - public function registerCalendarRoomBackend(string $class): void { |
|
| 291 | - $this->context->registerCalendarRoomBackend( |
|
| 292 | - $this->appId, |
|
| 293 | - $class |
|
| 294 | - ); |
|
| 295 | - } |
|
| 296 | - }; |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * @psalm-param class-string<ICapability> $capability |
|
| 301 | - */ |
|
| 302 | - public function registerCapability(string $appId, string $capability): void { |
|
| 303 | - $this->capabilities[] = new ServiceRegistration($appId, $capability); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * @psalm-param class-string<IReporter> $capability |
|
| 308 | - */ |
|
| 309 | - public function registerCrashReporter(string $appId, string $reporterClass): void { |
|
| 310 | - $this->crashReporters[] = new ServiceRegistration($appId, $reporterClass); |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * @psalm-param class-string<IWidget> $capability |
|
| 315 | - */ |
|
| 316 | - public function registerDashboardPanel(string $appId, string $panelClass): void { |
|
| 317 | - $this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass); |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void { |
|
| 321 | - $this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared); |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - public function registerServiceAlias(string $appId, string $alias, string $target): void { |
|
| 325 | - $this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target); |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - public function registerParameter(string $appId, string $name, $value): void { |
|
| 329 | - $this->parameters[] = new ParameterRegistration($appId, $name, $value); |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void { |
|
| 333 | - $this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority); |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - /** |
|
| 337 | - * @psalm-param class-string<Middleware> $class |
|
| 338 | - */ |
|
| 339 | - public function registerMiddleware(string $appId, string $class): void { |
|
| 340 | - $this->middlewares[] = new ServiceRegistration($appId, $class); |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - public function registerSearchProvider(string $appId, string $class) { |
|
| 344 | - $this->searchProviders[] = new ServiceRegistration($appId, $class); |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - public function registerAlternativeLogin(string $appId, string $class): void { |
|
| 348 | - $this->alternativeLogins[] = new ServiceRegistration($appId, $class); |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - public function registerInitialState(string $appId, string $class): void { |
|
| 352 | - $this->initialStates[] = new ServiceRegistration($appId, $class); |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - public function registerWellKnown(string $appId, string $class): void { |
|
| 356 | - $this->wellKnownHandlers[] = new ServiceRegistration($appId, $class); |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - public function registerTemplateProvider(string $appId, string $class): void { |
|
| 360 | - $this->templateProviders[] = new ServiceRegistration($appId, $class); |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - public function registerNotifierService(string $appId, string $class): void { |
|
| 364 | - $this->notifierServices[] = new ServiceRegistration($appId, $class); |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - public function registerTwoFactorProvider(string $appId, string $class): void { |
|
| 368 | - $this->twoFactorProviders[] = new ServiceRegistration($appId, $class); |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - public function registerPreviewProvider(string $appId, string $class, string $mimeTypeRegex): void { |
|
| 372 | - $this->previewProviders[] = new PreviewProviderRegistration($appId, $class, $mimeTypeRegex); |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - public function registerCalendarProvider(string $appId, string $class): void { |
|
| 376 | - $this->calendarProviders[] = new ServiceRegistration($appId, $class); |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - /** |
|
| 380 | - * @psalm-param class-string<ILinkAction> $actionClass |
|
| 381 | - */ |
|
| 382 | - public function registerProfileLinkAction(string $appId, string $actionClass): void { |
|
| 383 | - $this->profileLinkActions[] = new ServiceRegistration($appId, $actionClass); |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * @psalm-param class-string<ITalkBackend> $backend |
|
| 388 | - */ |
|
| 389 | - public function registerTalkBackend(string $appId, string $backend) { |
|
| 390 | - // Some safeguards for invalid registrations |
|
| 391 | - if ($appId !== 'spreed') { |
|
| 392 | - throw new RuntimeException("Only the Talk app is allowed to register a Talk backend"); |
|
| 393 | - } |
|
| 394 | - if ($this->talkBackendRegistration !== null) { |
|
| 395 | - throw new RuntimeException("There can only be one Talk backend"); |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - $this->talkBackendRegistration = new ServiceRegistration($appId, $backend); |
|
| 399 | - } |
|
| 400 | - |
|
| 401 | - public function registerCalendarResourceBackend(string $appId, string $class) { |
|
| 402 | - $this->calendarResourceBackendRegistrations[] = new ServiceRegistration( |
|
| 403 | - $appId, |
|
| 404 | - $class, |
|
| 405 | - ); |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - public function registerCalendarRoomBackend(string $appId, string $class) { |
|
| 409 | - $this->calendarRoomBackendRegistrations[] = new ServiceRegistration( |
|
| 410 | - $appId, |
|
| 411 | - $class, |
|
| 412 | - ); |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * @param App[] $apps |
|
| 417 | - */ |
|
| 418 | - public function delegateCapabilityRegistrations(array $apps): void { |
|
| 419 | - while (($registration = array_shift($this->capabilities)) !== null) { |
|
| 420 | - $appId = $registration->getAppId(); |
|
| 421 | - if (!isset($apps[$appId])) { |
|
| 422 | - // If we land here something really isn't right. But at least we caught the |
|
| 423 | - // notice that is otherwise emitted for the undefined index |
|
| 424 | - $this->logger->error("App $appId not loaded for the capability registration"); |
|
| 425 | - |
|
| 426 | - continue; |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - try { |
|
| 430 | - $apps[$appId] |
|
| 431 | - ->getContainer() |
|
| 432 | - ->registerCapability($registration->getService()); |
|
| 433 | - } catch (Throwable $e) { |
|
| 434 | - $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
| 435 | - 'exception' => $e, |
|
| 436 | - ]); |
|
| 437 | - } |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - /** |
|
| 442 | - * @param App[] $apps |
|
| 443 | - */ |
|
| 444 | - public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void { |
|
| 445 | - while (($registration = array_shift($this->crashReporters)) !== null) { |
|
| 446 | - try { |
|
| 447 | - $registry->registerLazy($registration->getService()); |
|
| 448 | - } catch (Throwable $e) { |
|
| 449 | - $appId = $registration->getAppId(); |
|
| 450 | - $this->logger->error("Error during crash reporter registration of $appId: " . $e->getMessage(), [ |
|
| 451 | - 'exception' => $e, |
|
| 452 | - ]); |
|
| 453 | - } |
|
| 454 | - } |
|
| 455 | - } |
|
| 456 | - |
|
| 457 | - /** |
|
| 458 | - * @param App[] $apps |
|
| 459 | - */ |
|
| 460 | - public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void { |
|
| 461 | - while (($panel = array_shift($this->dashboardPanels)) !== null) { |
|
| 462 | - try { |
|
| 463 | - $dashboardManager->lazyRegisterWidget($panel->getService()); |
|
| 464 | - } catch (Throwable $e) { |
|
| 465 | - $appId = $panel->getAppId(); |
|
| 466 | - $this->logger->error("Error during dashboard registration of $appId: " . $e->getMessage(), [ |
|
| 467 | - 'exception' => $e, |
|
| 468 | - ]); |
|
| 469 | - } |
|
| 470 | - } |
|
| 471 | - } |
|
| 472 | - |
|
| 473 | - public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void { |
|
| 474 | - while (($registration = array_shift($this->eventListeners)) !== null) { |
|
| 475 | - try { |
|
| 476 | - $eventDispatcher->addServiceListener( |
|
| 477 | - $registration->getEvent(), |
|
| 478 | - $registration->getService(), |
|
| 479 | - $registration->getPriority() |
|
| 480 | - ); |
|
| 481 | - } catch (Throwable $e) { |
|
| 482 | - $appId = $registration->getAppId(); |
|
| 483 | - $this->logger->error("Error during event listener registration of $appId: " . $e->getMessage(), [ |
|
| 484 | - 'exception' => $e, |
|
| 485 | - ]); |
|
| 486 | - } |
|
| 487 | - } |
|
| 488 | - } |
|
| 489 | - |
|
| 490 | - /** |
|
| 491 | - * @param App[] $apps |
|
| 492 | - */ |
|
| 493 | - public function delegateContainerRegistrations(array $apps): void { |
|
| 494 | - while (($registration = array_shift($this->services)) !== null) { |
|
| 495 | - $appId = $registration->getAppId(); |
|
| 496 | - if (!isset($apps[$appId])) { |
|
| 497 | - // If we land here something really isn't right. But at least we caught the |
|
| 498 | - // notice that is otherwise emitted for the undefined index |
|
| 499 | - $this->logger->error("App $appId not loaded for the container service registration"); |
|
| 500 | - |
|
| 501 | - continue; |
|
| 502 | - } |
|
| 503 | - |
|
| 504 | - try { |
|
| 505 | - /** |
|
| 506 | - * Register the service and convert the callable into a \Closure if necessary |
|
| 507 | - */ |
|
| 508 | - $apps[$appId] |
|
| 509 | - ->getContainer() |
|
| 510 | - ->registerService( |
|
| 511 | - $registration->getName(), |
|
| 512 | - Closure::fromCallable($registration->getFactory()), |
|
| 513 | - $registration->isShared() |
|
| 514 | - ); |
|
| 515 | - } catch (Throwable $e) { |
|
| 516 | - $this->logger->error("Error during service registration of $appId: " . $e->getMessage(), [ |
|
| 517 | - 'exception' => $e, |
|
| 518 | - ]); |
|
| 519 | - } |
|
| 520 | - } |
|
| 521 | - |
|
| 522 | - while (($registration = array_shift($this->aliases)) !== null) { |
|
| 523 | - $appId = $registration->getAppId(); |
|
| 524 | - if (!isset($apps[$appId])) { |
|
| 525 | - // If we land here something really isn't right. But at least we caught the |
|
| 526 | - // notice that is otherwise emitted for the undefined index |
|
| 527 | - $this->logger->error("App $appId not loaded for the container alias registration"); |
|
| 528 | - |
|
| 529 | - continue; |
|
| 530 | - } |
|
| 531 | - |
|
| 532 | - try { |
|
| 533 | - $apps[$appId] |
|
| 534 | - ->getContainer() |
|
| 535 | - ->registerAlias( |
|
| 536 | - $registration->getAlias(), |
|
| 537 | - $registration->getTarget() |
|
| 538 | - ); |
|
| 539 | - } catch (Throwable $e) { |
|
| 540 | - $this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [ |
|
| 541 | - 'exception' => $e, |
|
| 542 | - ]); |
|
| 543 | - } |
|
| 544 | - } |
|
| 545 | - |
|
| 546 | - while (($registration = array_shift($this->parameters)) !== null) { |
|
| 547 | - $appId = $registration->getAppId(); |
|
| 548 | - if (!isset($apps[$appId])) { |
|
| 549 | - // If we land here something really isn't right. But at least we caught the |
|
| 550 | - // notice that is otherwise emitted for the undefined index |
|
| 551 | - $this->logger->error("App $appId not loaded for the container parameter registration"); |
|
| 552 | - |
|
| 553 | - continue; |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - try { |
|
| 557 | - $apps[$appId] |
|
| 558 | - ->getContainer() |
|
| 559 | - ->registerParameter( |
|
| 560 | - $registration->getName(), |
|
| 561 | - $registration->getValue() |
|
| 562 | - ); |
|
| 563 | - } catch (Throwable $e) { |
|
| 564 | - $this->logger->error("Error during service parameter registration of $appId: " . $e->getMessage(), [ |
|
| 565 | - 'exception' => $e, |
|
| 566 | - ]); |
|
| 567 | - } |
|
| 568 | - } |
|
| 569 | - } |
|
| 570 | - |
|
| 571 | - /** |
|
| 572 | - * @param App[] $apps |
|
| 573 | - */ |
|
| 574 | - public function delegateMiddlewareRegistrations(array $apps): void { |
|
| 575 | - while (($middleware = array_shift($this->middlewares)) !== null) { |
|
| 576 | - $appId = $middleware->getAppId(); |
|
| 577 | - if (!isset($apps[$appId])) { |
|
| 578 | - // If we land here something really isn't right. But at least we caught the |
|
| 579 | - // notice that is otherwise emitted for the undefined index |
|
| 580 | - $this->logger->error("App $appId not loaded for the container middleware registration"); |
|
| 581 | - |
|
| 582 | - continue; |
|
| 583 | - } |
|
| 584 | - |
|
| 585 | - try { |
|
| 586 | - $apps[$appId] |
|
| 587 | - ->getContainer() |
|
| 588 | - ->registerMiddleWare($middleware->getService()); |
|
| 589 | - } catch (Throwable $e) { |
|
| 590 | - $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
| 591 | - 'exception' => $e, |
|
| 592 | - ]); |
|
| 593 | - } |
|
| 594 | - } |
|
| 595 | - } |
|
| 596 | - |
|
| 597 | - /** |
|
| 598 | - * @return ServiceRegistration<IProvider>[] |
|
| 599 | - */ |
|
| 600 | - public function getSearchProviders(): array { |
|
| 601 | - return $this->searchProviders; |
|
| 602 | - } |
|
| 603 | - |
|
| 604 | - /** |
|
| 605 | - * @return ServiceRegistration<IAlternativeLogin>[] |
|
| 606 | - */ |
|
| 607 | - public function getAlternativeLogins(): array { |
|
| 608 | - return $this->alternativeLogins; |
|
| 609 | - } |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * @return ServiceRegistration<InitialStateProvider>[] |
|
| 613 | - */ |
|
| 614 | - public function getInitialStates(): array { |
|
| 615 | - return $this->initialStates; |
|
| 616 | - } |
|
| 617 | - |
|
| 618 | - /** |
|
| 619 | - * @return ServiceRegistration<IHandler>[] |
|
| 620 | - */ |
|
| 621 | - public function getWellKnownHandlers(): array { |
|
| 622 | - return $this->wellKnownHandlers; |
|
| 623 | - } |
|
| 624 | - |
|
| 625 | - /** |
|
| 626 | - * @return ServiceRegistration<ICustomTemplateProvider>[] |
|
| 627 | - */ |
|
| 628 | - public function getTemplateProviders(): array { |
|
| 629 | - return $this->templateProviders; |
|
| 630 | - } |
|
| 631 | - |
|
| 632 | - /** |
|
| 633 | - * @return ServiceRegistration<INotifier>[] |
|
| 634 | - */ |
|
| 635 | - public function getNotifierServices(): array { |
|
| 636 | - return $this->notifierServices; |
|
| 637 | - } |
|
| 638 | - |
|
| 639 | - /** |
|
| 640 | - * @return ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] |
|
| 641 | - */ |
|
| 642 | - public function getTwoFactorProviders(): array { |
|
| 643 | - return $this->twoFactorProviders; |
|
| 644 | - } |
|
| 645 | - |
|
| 646 | - /** |
|
| 647 | - * @return PreviewProviderRegistration[] |
|
| 648 | - */ |
|
| 649 | - public function getPreviewProviders(): array { |
|
| 650 | - return $this->previewProviders; |
|
| 651 | - } |
|
| 652 | - |
|
| 653 | - /** |
|
| 654 | - * @return ServiceRegistration<ICalendarProvider>[] |
|
| 655 | - */ |
|
| 656 | - public function getCalendarProviders(): array { |
|
| 657 | - return $this->calendarProviders; |
|
| 658 | - } |
|
| 659 | - |
|
| 660 | - /** |
|
| 661 | - * @return ServiceRegistration<ILinkAction>[] |
|
| 662 | - */ |
|
| 663 | - public function getProfileLinkActions(): array { |
|
| 664 | - return $this->profileLinkActions; |
|
| 665 | - } |
|
| 666 | - |
|
| 667 | - /** |
|
| 668 | - * @return ServiceRegistration|null |
|
| 669 | - * @psalm-return ServiceRegistration<ITalkBackend>|null |
|
| 670 | - */ |
|
| 671 | - public function getTalkBackendRegistration(): ?ServiceRegistration { |
|
| 672 | - return $this->talkBackendRegistration; |
|
| 673 | - } |
|
| 674 | - |
|
| 675 | - /** |
|
| 676 | - * @return ServiceRegistration[] |
|
| 677 | - * @psalm-return ServiceRegistration<IResourceBackend>[] |
|
| 678 | - */ |
|
| 679 | - public function getCalendarResourceBackendRegistrations(): array { |
|
| 680 | - return $this->calendarResourceBackendRegistrations; |
|
| 681 | - } |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * @return ServiceRegistration[] |
|
| 685 | - * @psalm-return ServiceRegistration<IRoomBackend>[] |
|
| 686 | - */ |
|
| 687 | - public function getCalendarRoomBackendRegistrations(): array { |
|
| 688 | - return $this->calendarRoomBackendRegistrations; |
|
| 689 | - } |
|
| 90 | + /** @var EventListenerRegistration[] */ |
|
| 91 | + private $eventListeners = []; |
|
| 92 | + |
|
| 93 | + /** @var ServiceRegistration<Middleware>[] */ |
|
| 94 | + private $middlewares = []; |
|
| 95 | + |
|
| 96 | + /** @var ServiceRegistration<IProvider>[] */ |
|
| 97 | + private $searchProviders = []; |
|
| 98 | + |
|
| 99 | + /** @var ServiceRegistration<IAlternativeLogin>[] */ |
|
| 100 | + private $alternativeLogins = []; |
|
| 101 | + |
|
| 102 | + /** @var ServiceRegistration<InitialStateProvider>[] */ |
|
| 103 | + private $initialStates = []; |
|
| 104 | + |
|
| 105 | + /** @var ServiceRegistration<IHandler>[] */ |
|
| 106 | + private $wellKnownHandlers = []; |
|
| 107 | + |
|
| 108 | + /** @var ServiceRegistration<ICustomTemplateProvider>[] */ |
|
| 109 | + private $templateProviders = []; |
|
| 110 | + |
|
| 111 | + /** @var ServiceRegistration<INotifier>[] */ |
|
| 112 | + private $notifierServices = []; |
|
| 113 | + |
|
| 114 | + /** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */ |
|
| 115 | + private $twoFactorProviders = []; |
|
| 116 | + |
|
| 117 | + /** @var ServiceRegistration<ICalendarProvider>[] */ |
|
| 118 | + private $calendarProviders = []; |
|
| 119 | + |
|
| 120 | + /** @var LoggerInterface */ |
|
| 121 | + private $logger; |
|
| 122 | + |
|
| 123 | + /** @var PreviewProviderRegistration[] */ |
|
| 124 | + private $previewProviders = []; |
|
| 125 | + |
|
| 126 | + public function __construct(LoggerInterface $logger) { |
|
| 127 | + $this->logger = $logger; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + public function for(string $appId): IRegistrationContext { |
|
| 131 | + return new class($appId, $this) implements IRegistrationContext { |
|
| 132 | + /** @var string */ |
|
| 133 | + private $appId; |
|
| 134 | + |
|
| 135 | + /** @var RegistrationContext */ |
|
| 136 | + private $context; |
|
| 137 | + |
|
| 138 | + public function __construct(string $appId, RegistrationContext $context) { |
|
| 139 | + $this->appId = $appId; |
|
| 140 | + $this->context = $context; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + public function registerCapability(string $capability): void { |
|
| 144 | + $this->context->registerCapability( |
|
| 145 | + $this->appId, |
|
| 146 | + $capability |
|
| 147 | + ); |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + public function registerCrashReporter(string $reporterClass): void { |
|
| 151 | + $this->context->registerCrashReporter( |
|
| 152 | + $this->appId, |
|
| 153 | + $reporterClass |
|
| 154 | + ); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + public function registerDashboardWidget(string $widgetClass): void { |
|
| 158 | + $this->context->registerDashboardPanel( |
|
| 159 | + $this->appId, |
|
| 160 | + $widgetClass |
|
| 161 | + ); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + public function registerService(string $name, callable $factory, bool $shared = true): void { |
|
| 165 | + $this->context->registerService( |
|
| 166 | + $this->appId, |
|
| 167 | + $name, |
|
| 168 | + $factory, |
|
| 169 | + $shared |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + public function registerServiceAlias(string $alias, string $target): void { |
|
| 174 | + $this->context->registerServiceAlias( |
|
| 175 | + $this->appId, |
|
| 176 | + $alias, |
|
| 177 | + $target |
|
| 178 | + ); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + public function registerParameter(string $name, $value): void { |
|
| 182 | + $this->context->registerParameter( |
|
| 183 | + $this->appId, |
|
| 184 | + $name, |
|
| 185 | + $value |
|
| 186 | + ); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + public function registerEventListener(string $event, string $listener, int $priority = 0): void { |
|
| 190 | + $this->context->registerEventListener( |
|
| 191 | + $this->appId, |
|
| 192 | + $event, |
|
| 193 | + $listener, |
|
| 194 | + $priority |
|
| 195 | + ); |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + public function registerMiddleware(string $class): void { |
|
| 199 | + $this->context->registerMiddleware( |
|
| 200 | + $this->appId, |
|
| 201 | + $class |
|
| 202 | + ); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + public function registerSearchProvider(string $class): void { |
|
| 206 | + $this->context->registerSearchProvider( |
|
| 207 | + $this->appId, |
|
| 208 | + $class |
|
| 209 | + ); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + public function registerAlternativeLogin(string $class): void { |
|
| 213 | + $this->context->registerAlternativeLogin( |
|
| 214 | + $this->appId, |
|
| 215 | + $class |
|
| 216 | + ); |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + public function registerInitialStateProvider(string $class): void { |
|
| 220 | + $this->context->registerInitialState( |
|
| 221 | + $this->appId, |
|
| 222 | + $class |
|
| 223 | + ); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + public function registerWellKnownHandler(string $class): void { |
|
| 227 | + $this->context->registerWellKnown( |
|
| 228 | + $this->appId, |
|
| 229 | + $class |
|
| 230 | + ); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + public function registerTemplateProvider(string $providerClass): void { |
|
| 234 | + $this->context->registerTemplateProvider( |
|
| 235 | + $this->appId, |
|
| 236 | + $providerClass |
|
| 237 | + ); |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + public function registerNotifierService(string $notifierClass): void { |
|
| 241 | + $this->context->registerNotifierService( |
|
| 242 | + $this->appId, |
|
| 243 | + $notifierClass |
|
| 244 | + ); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + public function registerTwoFactorProvider(string $twoFactorProviderClass): void { |
|
| 248 | + $this->context->registerTwoFactorProvider( |
|
| 249 | + $this->appId, |
|
| 250 | + $twoFactorProviderClass |
|
| 251 | + ); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void { |
|
| 255 | + $this->context->registerPreviewProvider( |
|
| 256 | + $this->appId, |
|
| 257 | + $previewProviderClass, |
|
| 258 | + $mimeTypeRegex |
|
| 259 | + ); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + public function registerCalendarProvider(string $class): void { |
|
| 263 | + $this->context->registerCalendarProvider( |
|
| 264 | + $this->appId, |
|
| 265 | + $class |
|
| 266 | + ); |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + public function registerProfileLinkAction(string $actionClass): void { |
|
| 270 | + $this->context->registerProfileLinkAction( |
|
| 271 | + $this->appId, |
|
| 272 | + $actionClass |
|
| 273 | + ); |
|
| 274 | + } |
|
| 275 | + |
|
| 276 | + public function registerTalkBackend(string $backend): void { |
|
| 277 | + $this->context->registerTalkBackend( |
|
| 278 | + $this->appId, |
|
| 279 | + $backend |
|
| 280 | + ); |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + public function registerCalendarResourceBackend(string $class): void { |
|
| 284 | + $this->context->registerCalendarResourceBackend( |
|
| 285 | + $this->appId, |
|
| 286 | + $class |
|
| 287 | + ); |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + public function registerCalendarRoomBackend(string $class): void { |
|
| 291 | + $this->context->registerCalendarRoomBackend( |
|
| 292 | + $this->appId, |
|
| 293 | + $class |
|
| 294 | + ); |
|
| 295 | + } |
|
| 296 | + }; |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * @psalm-param class-string<ICapability> $capability |
|
| 301 | + */ |
|
| 302 | + public function registerCapability(string $appId, string $capability): void { |
|
| 303 | + $this->capabilities[] = new ServiceRegistration($appId, $capability); |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * @psalm-param class-string<IReporter> $capability |
|
| 308 | + */ |
|
| 309 | + public function registerCrashReporter(string $appId, string $reporterClass): void { |
|
| 310 | + $this->crashReporters[] = new ServiceRegistration($appId, $reporterClass); |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * @psalm-param class-string<IWidget> $capability |
|
| 315 | + */ |
|
| 316 | + public function registerDashboardPanel(string $appId, string $panelClass): void { |
|
| 317 | + $this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass); |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void { |
|
| 321 | + $this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared); |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + public function registerServiceAlias(string $appId, string $alias, string $target): void { |
|
| 325 | + $this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target); |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + public function registerParameter(string $appId, string $name, $value): void { |
|
| 329 | + $this->parameters[] = new ParameterRegistration($appId, $name, $value); |
|
| 330 | + } |
|
| 331 | + |
|
| 332 | + public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void { |
|
| 333 | + $this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority); |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + /** |
|
| 337 | + * @psalm-param class-string<Middleware> $class |
|
| 338 | + */ |
|
| 339 | + public function registerMiddleware(string $appId, string $class): void { |
|
| 340 | + $this->middlewares[] = new ServiceRegistration($appId, $class); |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + public function registerSearchProvider(string $appId, string $class) { |
|
| 344 | + $this->searchProviders[] = new ServiceRegistration($appId, $class); |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + public function registerAlternativeLogin(string $appId, string $class): void { |
|
| 348 | + $this->alternativeLogins[] = new ServiceRegistration($appId, $class); |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + public function registerInitialState(string $appId, string $class): void { |
|
| 352 | + $this->initialStates[] = new ServiceRegistration($appId, $class); |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + public function registerWellKnown(string $appId, string $class): void { |
|
| 356 | + $this->wellKnownHandlers[] = new ServiceRegistration($appId, $class); |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + public function registerTemplateProvider(string $appId, string $class): void { |
|
| 360 | + $this->templateProviders[] = new ServiceRegistration($appId, $class); |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + public function registerNotifierService(string $appId, string $class): void { |
|
| 364 | + $this->notifierServices[] = new ServiceRegistration($appId, $class); |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + public function registerTwoFactorProvider(string $appId, string $class): void { |
|
| 368 | + $this->twoFactorProviders[] = new ServiceRegistration($appId, $class); |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + public function registerPreviewProvider(string $appId, string $class, string $mimeTypeRegex): void { |
|
| 372 | + $this->previewProviders[] = new PreviewProviderRegistration($appId, $class, $mimeTypeRegex); |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + public function registerCalendarProvider(string $appId, string $class): void { |
|
| 376 | + $this->calendarProviders[] = new ServiceRegistration($appId, $class); |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + /** |
|
| 380 | + * @psalm-param class-string<ILinkAction> $actionClass |
|
| 381 | + */ |
|
| 382 | + public function registerProfileLinkAction(string $appId, string $actionClass): void { |
|
| 383 | + $this->profileLinkActions[] = new ServiceRegistration($appId, $actionClass); |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * @psalm-param class-string<ITalkBackend> $backend |
|
| 388 | + */ |
|
| 389 | + public function registerTalkBackend(string $appId, string $backend) { |
|
| 390 | + // Some safeguards for invalid registrations |
|
| 391 | + if ($appId !== 'spreed') { |
|
| 392 | + throw new RuntimeException("Only the Talk app is allowed to register a Talk backend"); |
|
| 393 | + } |
|
| 394 | + if ($this->talkBackendRegistration !== null) { |
|
| 395 | + throw new RuntimeException("There can only be one Talk backend"); |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + $this->talkBackendRegistration = new ServiceRegistration($appId, $backend); |
|
| 399 | + } |
|
| 400 | + |
|
| 401 | + public function registerCalendarResourceBackend(string $appId, string $class) { |
|
| 402 | + $this->calendarResourceBackendRegistrations[] = new ServiceRegistration( |
|
| 403 | + $appId, |
|
| 404 | + $class, |
|
| 405 | + ); |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + public function registerCalendarRoomBackend(string $appId, string $class) { |
|
| 409 | + $this->calendarRoomBackendRegistrations[] = new ServiceRegistration( |
|
| 410 | + $appId, |
|
| 411 | + $class, |
|
| 412 | + ); |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * @param App[] $apps |
|
| 417 | + */ |
|
| 418 | + public function delegateCapabilityRegistrations(array $apps): void { |
|
| 419 | + while (($registration = array_shift($this->capabilities)) !== null) { |
|
| 420 | + $appId = $registration->getAppId(); |
|
| 421 | + if (!isset($apps[$appId])) { |
|
| 422 | + // If we land here something really isn't right. But at least we caught the |
|
| 423 | + // notice that is otherwise emitted for the undefined index |
|
| 424 | + $this->logger->error("App $appId not loaded for the capability registration"); |
|
| 425 | + |
|
| 426 | + continue; |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + try { |
|
| 430 | + $apps[$appId] |
|
| 431 | + ->getContainer() |
|
| 432 | + ->registerCapability($registration->getService()); |
|
| 433 | + } catch (Throwable $e) { |
|
| 434 | + $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
| 435 | + 'exception' => $e, |
|
| 436 | + ]); |
|
| 437 | + } |
|
| 438 | + } |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + /** |
|
| 442 | + * @param App[] $apps |
|
| 443 | + */ |
|
| 444 | + public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void { |
|
| 445 | + while (($registration = array_shift($this->crashReporters)) !== null) { |
|
| 446 | + try { |
|
| 447 | + $registry->registerLazy($registration->getService()); |
|
| 448 | + } catch (Throwable $e) { |
|
| 449 | + $appId = $registration->getAppId(); |
|
| 450 | + $this->logger->error("Error during crash reporter registration of $appId: " . $e->getMessage(), [ |
|
| 451 | + 'exception' => $e, |
|
| 452 | + ]); |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + } |
|
| 456 | + |
|
| 457 | + /** |
|
| 458 | + * @param App[] $apps |
|
| 459 | + */ |
|
| 460 | + public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void { |
|
| 461 | + while (($panel = array_shift($this->dashboardPanels)) !== null) { |
|
| 462 | + try { |
|
| 463 | + $dashboardManager->lazyRegisterWidget($panel->getService()); |
|
| 464 | + } catch (Throwable $e) { |
|
| 465 | + $appId = $panel->getAppId(); |
|
| 466 | + $this->logger->error("Error during dashboard registration of $appId: " . $e->getMessage(), [ |
|
| 467 | + 'exception' => $e, |
|
| 468 | + ]); |
|
| 469 | + } |
|
| 470 | + } |
|
| 471 | + } |
|
| 472 | + |
|
| 473 | + public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void { |
|
| 474 | + while (($registration = array_shift($this->eventListeners)) !== null) { |
|
| 475 | + try { |
|
| 476 | + $eventDispatcher->addServiceListener( |
|
| 477 | + $registration->getEvent(), |
|
| 478 | + $registration->getService(), |
|
| 479 | + $registration->getPriority() |
|
| 480 | + ); |
|
| 481 | + } catch (Throwable $e) { |
|
| 482 | + $appId = $registration->getAppId(); |
|
| 483 | + $this->logger->error("Error during event listener registration of $appId: " . $e->getMessage(), [ |
|
| 484 | + 'exception' => $e, |
|
| 485 | + ]); |
|
| 486 | + } |
|
| 487 | + } |
|
| 488 | + } |
|
| 489 | + |
|
| 490 | + /** |
|
| 491 | + * @param App[] $apps |
|
| 492 | + */ |
|
| 493 | + public function delegateContainerRegistrations(array $apps): void { |
|
| 494 | + while (($registration = array_shift($this->services)) !== null) { |
|
| 495 | + $appId = $registration->getAppId(); |
|
| 496 | + if (!isset($apps[$appId])) { |
|
| 497 | + // If we land here something really isn't right. But at least we caught the |
|
| 498 | + // notice that is otherwise emitted for the undefined index |
|
| 499 | + $this->logger->error("App $appId not loaded for the container service registration"); |
|
| 500 | + |
|
| 501 | + continue; |
|
| 502 | + } |
|
| 503 | + |
|
| 504 | + try { |
|
| 505 | + /** |
|
| 506 | + * Register the service and convert the callable into a \Closure if necessary |
|
| 507 | + */ |
|
| 508 | + $apps[$appId] |
|
| 509 | + ->getContainer() |
|
| 510 | + ->registerService( |
|
| 511 | + $registration->getName(), |
|
| 512 | + Closure::fromCallable($registration->getFactory()), |
|
| 513 | + $registration->isShared() |
|
| 514 | + ); |
|
| 515 | + } catch (Throwable $e) { |
|
| 516 | + $this->logger->error("Error during service registration of $appId: " . $e->getMessage(), [ |
|
| 517 | + 'exception' => $e, |
|
| 518 | + ]); |
|
| 519 | + } |
|
| 520 | + } |
|
| 521 | + |
|
| 522 | + while (($registration = array_shift($this->aliases)) !== null) { |
|
| 523 | + $appId = $registration->getAppId(); |
|
| 524 | + if (!isset($apps[$appId])) { |
|
| 525 | + // If we land here something really isn't right. But at least we caught the |
|
| 526 | + // notice that is otherwise emitted for the undefined index |
|
| 527 | + $this->logger->error("App $appId not loaded for the container alias registration"); |
|
| 528 | + |
|
| 529 | + continue; |
|
| 530 | + } |
|
| 531 | + |
|
| 532 | + try { |
|
| 533 | + $apps[$appId] |
|
| 534 | + ->getContainer() |
|
| 535 | + ->registerAlias( |
|
| 536 | + $registration->getAlias(), |
|
| 537 | + $registration->getTarget() |
|
| 538 | + ); |
|
| 539 | + } catch (Throwable $e) { |
|
| 540 | + $this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [ |
|
| 541 | + 'exception' => $e, |
|
| 542 | + ]); |
|
| 543 | + } |
|
| 544 | + } |
|
| 545 | + |
|
| 546 | + while (($registration = array_shift($this->parameters)) !== null) { |
|
| 547 | + $appId = $registration->getAppId(); |
|
| 548 | + if (!isset($apps[$appId])) { |
|
| 549 | + // If we land here something really isn't right. But at least we caught the |
|
| 550 | + // notice that is otherwise emitted for the undefined index |
|
| 551 | + $this->logger->error("App $appId not loaded for the container parameter registration"); |
|
| 552 | + |
|
| 553 | + continue; |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + try { |
|
| 557 | + $apps[$appId] |
|
| 558 | + ->getContainer() |
|
| 559 | + ->registerParameter( |
|
| 560 | + $registration->getName(), |
|
| 561 | + $registration->getValue() |
|
| 562 | + ); |
|
| 563 | + } catch (Throwable $e) { |
|
| 564 | + $this->logger->error("Error during service parameter registration of $appId: " . $e->getMessage(), [ |
|
| 565 | + 'exception' => $e, |
|
| 566 | + ]); |
|
| 567 | + } |
|
| 568 | + } |
|
| 569 | + } |
|
| 570 | + |
|
| 571 | + /** |
|
| 572 | + * @param App[] $apps |
|
| 573 | + */ |
|
| 574 | + public function delegateMiddlewareRegistrations(array $apps): void { |
|
| 575 | + while (($middleware = array_shift($this->middlewares)) !== null) { |
|
| 576 | + $appId = $middleware->getAppId(); |
|
| 577 | + if (!isset($apps[$appId])) { |
|
| 578 | + // If we land here something really isn't right. But at least we caught the |
|
| 579 | + // notice that is otherwise emitted for the undefined index |
|
| 580 | + $this->logger->error("App $appId not loaded for the container middleware registration"); |
|
| 581 | + |
|
| 582 | + continue; |
|
| 583 | + } |
|
| 584 | + |
|
| 585 | + try { |
|
| 586 | + $apps[$appId] |
|
| 587 | + ->getContainer() |
|
| 588 | + ->registerMiddleWare($middleware->getService()); |
|
| 589 | + } catch (Throwable $e) { |
|
| 590 | + $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
| 591 | + 'exception' => $e, |
|
| 592 | + ]); |
|
| 593 | + } |
|
| 594 | + } |
|
| 595 | + } |
|
| 596 | + |
|
| 597 | + /** |
|
| 598 | + * @return ServiceRegistration<IProvider>[] |
|
| 599 | + */ |
|
| 600 | + public function getSearchProviders(): array { |
|
| 601 | + return $this->searchProviders; |
|
| 602 | + } |
|
| 603 | + |
|
| 604 | + /** |
|
| 605 | + * @return ServiceRegistration<IAlternativeLogin>[] |
|
| 606 | + */ |
|
| 607 | + public function getAlternativeLogins(): array { |
|
| 608 | + return $this->alternativeLogins; |
|
| 609 | + } |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * @return ServiceRegistration<InitialStateProvider>[] |
|
| 613 | + */ |
|
| 614 | + public function getInitialStates(): array { |
|
| 615 | + return $this->initialStates; |
|
| 616 | + } |
|
| 617 | + |
|
| 618 | + /** |
|
| 619 | + * @return ServiceRegistration<IHandler>[] |
|
| 620 | + */ |
|
| 621 | + public function getWellKnownHandlers(): array { |
|
| 622 | + return $this->wellKnownHandlers; |
|
| 623 | + } |
|
| 624 | + |
|
| 625 | + /** |
|
| 626 | + * @return ServiceRegistration<ICustomTemplateProvider>[] |
|
| 627 | + */ |
|
| 628 | + public function getTemplateProviders(): array { |
|
| 629 | + return $this->templateProviders; |
|
| 630 | + } |
|
| 631 | + |
|
| 632 | + /** |
|
| 633 | + * @return ServiceRegistration<INotifier>[] |
|
| 634 | + */ |
|
| 635 | + public function getNotifierServices(): array { |
|
| 636 | + return $this->notifierServices; |
|
| 637 | + } |
|
| 638 | + |
|
| 639 | + /** |
|
| 640 | + * @return ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] |
|
| 641 | + */ |
|
| 642 | + public function getTwoFactorProviders(): array { |
|
| 643 | + return $this->twoFactorProviders; |
|
| 644 | + } |
|
| 645 | + |
|
| 646 | + /** |
|
| 647 | + * @return PreviewProviderRegistration[] |
|
| 648 | + */ |
|
| 649 | + public function getPreviewProviders(): array { |
|
| 650 | + return $this->previewProviders; |
|
| 651 | + } |
|
| 652 | + |
|
| 653 | + /** |
|
| 654 | + * @return ServiceRegistration<ICalendarProvider>[] |
|
| 655 | + */ |
|
| 656 | + public function getCalendarProviders(): array { |
|
| 657 | + return $this->calendarProviders; |
|
| 658 | + } |
|
| 659 | + |
|
| 660 | + /** |
|
| 661 | + * @return ServiceRegistration<ILinkAction>[] |
|
| 662 | + */ |
|
| 663 | + public function getProfileLinkActions(): array { |
|
| 664 | + return $this->profileLinkActions; |
|
| 665 | + } |
|
| 666 | + |
|
| 667 | + /** |
|
| 668 | + * @return ServiceRegistration|null |
|
| 669 | + * @psalm-return ServiceRegistration<ITalkBackend>|null |
|
| 670 | + */ |
|
| 671 | + public function getTalkBackendRegistration(): ?ServiceRegistration { |
|
| 672 | + return $this->talkBackendRegistration; |
|
| 673 | + } |
|
| 674 | + |
|
| 675 | + /** |
|
| 676 | + * @return ServiceRegistration[] |
|
| 677 | + * @psalm-return ServiceRegistration<IResourceBackend>[] |
|
| 678 | + */ |
|
| 679 | + public function getCalendarResourceBackendRegistrations(): array { |
|
| 680 | + return $this->calendarResourceBackendRegistrations; |
|
| 681 | + } |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * @return ServiceRegistration[] |
|
| 685 | + * @psalm-return ServiceRegistration<IRoomBackend>[] |
|
| 686 | + */ |
|
| 687 | + public function getCalendarRoomBackendRegistrations(): array { |
|
| 688 | + return $this->calendarRoomBackendRegistrations; |
|
| 689 | + } |
|
| 690 | 690 | } |
@@ -31,46 +31,46 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | interface IManager { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Registers a resource backend |
|
| 36 | - * |
|
| 37 | - * @param string $backendClass |
|
| 38 | - * @return void |
|
| 39 | - * @since 14.0.0 |
|
| 40 | - * @deprecated 24.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarResourceBackend |
|
| 41 | - */ |
|
| 42 | - public function registerBackend(string $backendClass); |
|
| 34 | + /** |
|
| 35 | + * Registers a resource backend |
|
| 36 | + * |
|
| 37 | + * @param string $backendClass |
|
| 38 | + * @return void |
|
| 39 | + * @since 14.0.0 |
|
| 40 | + * @deprecated 24.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarResourceBackend |
|
| 41 | + */ |
|
| 42 | + public function registerBackend(string $backendClass); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Unregisters a resource backend |
|
| 46 | - * |
|
| 47 | - * @param string $backendClass |
|
| 48 | - * @return void |
|
| 49 | - * @since 14.0.0 |
|
| 50 | - * @deprecated 24.0.0 |
|
| 51 | - */ |
|
| 52 | - public function unregisterBackend(string $backendClass); |
|
| 44 | + /** |
|
| 45 | + * Unregisters a resource backend |
|
| 46 | + * |
|
| 47 | + * @param string $backendClass |
|
| 48 | + * @return void |
|
| 49 | + * @since 14.0.0 |
|
| 50 | + * @deprecated 24.0.0 |
|
| 51 | + */ |
|
| 52 | + public function unregisterBackend(string $backendClass); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @return IBackend[] |
|
| 56 | - * @since 14.0.0 |
|
| 57 | - * @deprecated 24.0.0 |
|
| 58 | - */ |
|
| 59 | - public function getBackends():array; |
|
| 54 | + /** |
|
| 55 | + * @return IBackend[] |
|
| 56 | + * @since 14.0.0 |
|
| 57 | + * @deprecated 24.0.0 |
|
| 58 | + */ |
|
| 59 | + public function getBackends():array; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @param string $backendId |
|
| 63 | - * @return IBackend|null |
|
| 64 | - * @since 14.0.0 |
|
| 65 | - * @deprecated 24.0.0 |
|
| 66 | - */ |
|
| 67 | - public function getBackend($backendId); |
|
| 61 | + /** |
|
| 62 | + * @param string $backendId |
|
| 63 | + * @return IBackend|null |
|
| 64 | + * @since 14.0.0 |
|
| 65 | + * @deprecated 24.0.0 |
|
| 66 | + */ |
|
| 67 | + public function getBackend($backendId); |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * removes all registered backend instances |
|
| 71 | - * @return void |
|
| 72 | - * @since 14.0.0 |
|
| 73 | - * @deprecated 24.0.0 |
|
| 74 | - */ |
|
| 75 | - public function clear(); |
|
| 69 | + /** |
|
| 70 | + * removes all registered backend instances |
|
| 71 | + * @return void |
|
| 72 | + * @since 14.0.0 |
|
| 73 | + * @deprecated 24.0.0 |
|
| 74 | + */ |
|
| 75 | + public function clear(); |
|
| 76 | 76 | } |
@@ -31,46 +31,46 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | interface IManager { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Registers a room backend |
|
| 36 | - * |
|
| 37 | - * @param string $backendClass |
|
| 38 | - * @return void |
|
| 39 | - * @since 14.0.0 |
|
| 40 | - * @deprecated 24.0.0 use \OC\AppFramework\Bootstrap\::registerCalendarRoomBackend |
|
| 41 | - */ |
|
| 42 | - public function registerBackend(string $backendClass); |
|
| 34 | + /** |
|
| 35 | + * Registers a room backend |
|
| 36 | + * |
|
| 37 | + * @param string $backendClass |
|
| 38 | + * @return void |
|
| 39 | + * @since 14.0.0 |
|
| 40 | + * @deprecated 24.0.0 use \OC\AppFramework\Bootstrap\::registerCalendarRoomBackend |
|
| 41 | + */ |
|
| 42 | + public function registerBackend(string $backendClass); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Unregisters a room backend |
|
| 46 | - * |
|
| 47 | - * @param string $backendClass |
|
| 48 | - * @return void |
|
| 49 | - * @since 14.0.0 |
|
| 50 | - * @deprecated 24.0.0 |
|
| 51 | - */ |
|
| 52 | - public function unregisterBackend(string $backendClass); |
|
| 44 | + /** |
|
| 45 | + * Unregisters a room backend |
|
| 46 | + * |
|
| 47 | + * @param string $backendClass |
|
| 48 | + * @return void |
|
| 49 | + * @since 14.0.0 |
|
| 50 | + * @deprecated 24.0.0 |
|
| 51 | + */ |
|
| 52 | + public function unregisterBackend(string $backendClass); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @return IBackend[] |
|
| 56 | - * @since 14.0.0 |
|
| 57 | - * @deprecated 24.0.0 |
|
| 58 | - */ |
|
| 59 | - public function getBackends():array; |
|
| 54 | + /** |
|
| 55 | + * @return IBackend[] |
|
| 56 | + * @since 14.0.0 |
|
| 57 | + * @deprecated 24.0.0 |
|
| 58 | + */ |
|
| 59 | + public function getBackends():array; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @param string $backendId |
|
| 63 | - * @return IBackend|null |
|
| 64 | - * @since 14.0.0 |
|
| 65 | - * @deprecated 24.0.0 |
|
| 66 | - */ |
|
| 67 | - public function getBackend($backendId); |
|
| 61 | + /** |
|
| 62 | + * @param string $backendId |
|
| 63 | + * @return IBackend|null |
|
| 64 | + * @since 14.0.0 |
|
| 65 | + * @deprecated 24.0.0 |
|
| 66 | + */ |
|
| 67 | + public function getBackend($backendId); |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * removes all registered backend instances |
|
| 71 | - * @return void |
|
| 72 | - * @since 14.0.0 |
|
| 73 | - * @deprecated 24.0.0 |
|
| 74 | - */ |
|
| 75 | - public function clear(); |
|
| 69 | + /** |
|
| 70 | + * removes all registered backend instances |
|
| 71 | + * @return void |
|
| 72 | + * @since 14.0.0 |
|
| 73 | + * @deprecated 24.0.0 |
|
| 74 | + */ |
|
| 75 | + public function clear(); |
|
| 76 | 76 | } |
@@ -47,252 +47,252 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | interface IRegistrationContext { |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param string $capability |
|
| 52 | - * @psalm-param class-string<ICapability> $capability |
|
| 53 | - * @see IAppContainer::registerCapability |
|
| 54 | - * |
|
| 55 | - * @since 20.0.0 |
|
| 56 | - */ |
|
| 57 | - public function registerCapability(string $capability): void; |
|
| 50 | + /** |
|
| 51 | + * @param string $capability |
|
| 52 | + * @psalm-param class-string<ICapability> $capability |
|
| 53 | + * @see IAppContainer::registerCapability |
|
| 54 | + * |
|
| 55 | + * @since 20.0.0 |
|
| 56 | + */ |
|
| 57 | + public function registerCapability(string $capability): void; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Register an implementation of \OCP\Support\CrashReport\IReporter that |
|
| 61 | - * will receive unhandled exceptions and throwables |
|
| 62 | - * |
|
| 63 | - * @param string $reporterClass |
|
| 64 | - * @psalm-param class-string<\OCP\Support\CrashReport\IReporter> $reporterClass |
|
| 65 | - * @return void |
|
| 66 | - * @since 20.0.0 |
|
| 67 | - */ |
|
| 68 | - public function registerCrashReporter(string $reporterClass): void; |
|
| 59 | + /** |
|
| 60 | + * Register an implementation of \OCP\Support\CrashReport\IReporter that |
|
| 61 | + * will receive unhandled exceptions and throwables |
|
| 62 | + * |
|
| 63 | + * @param string $reporterClass |
|
| 64 | + * @psalm-param class-string<\OCP\Support\CrashReport\IReporter> $reporterClass |
|
| 65 | + * @return void |
|
| 66 | + * @since 20.0.0 |
|
| 67 | + */ |
|
| 68 | + public function registerCrashReporter(string $reporterClass): void; |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Register an implementation of \OCP\Dashboard\IWidget that |
|
| 72 | - * will handle the implementation of a dashboard widget |
|
| 73 | - * |
|
| 74 | - * @param string $widgetClass |
|
| 75 | - * @psalm-param class-string<\OCP\Dashboard\IWidget> $widgetClass |
|
| 76 | - * @return void |
|
| 77 | - * @since 20.0.0 |
|
| 78 | - */ |
|
| 79 | - public function registerDashboardWidget(string $widgetClass): void; |
|
| 70 | + /** |
|
| 71 | + * Register an implementation of \OCP\Dashboard\IWidget that |
|
| 72 | + * will handle the implementation of a dashboard widget |
|
| 73 | + * |
|
| 74 | + * @param string $widgetClass |
|
| 75 | + * @psalm-param class-string<\OCP\Dashboard\IWidget> $widgetClass |
|
| 76 | + * @return void |
|
| 77 | + * @since 20.0.0 |
|
| 78 | + */ |
|
| 79 | + public function registerDashboardWidget(string $widgetClass): void; |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Register a service |
|
| 83 | - * |
|
| 84 | - * @param string $name |
|
| 85 | - * @param callable $factory |
|
| 86 | - * @psalm-param callable(\Psr\Container\ContainerInterface): mixed $factory |
|
| 87 | - * @param bool $shared |
|
| 88 | - * |
|
| 89 | - * @return void |
|
| 90 | - * @see IContainer::registerService() |
|
| 91 | - * |
|
| 92 | - * @since 20.0.0 |
|
| 93 | - */ |
|
| 94 | - public function registerService(string $name, callable $factory, bool $shared = true): void; |
|
| 81 | + /** |
|
| 82 | + * Register a service |
|
| 83 | + * |
|
| 84 | + * @param string $name |
|
| 85 | + * @param callable $factory |
|
| 86 | + * @psalm-param callable(\Psr\Container\ContainerInterface): mixed $factory |
|
| 87 | + * @param bool $shared |
|
| 88 | + * |
|
| 89 | + * @return void |
|
| 90 | + * @see IContainer::registerService() |
|
| 91 | + * |
|
| 92 | + * @since 20.0.0 |
|
| 93 | + */ |
|
| 94 | + public function registerService(string $name, callable $factory, bool $shared = true): void; |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * @param string $alias |
|
| 98 | - * @psalm-param string|class-string $alias |
|
| 99 | - * @param string $target |
|
| 100 | - * @psalm-param string|class-string $target |
|
| 101 | - * |
|
| 102 | - * @return void |
|
| 103 | - * @see IContainer::registerAlias() |
|
| 104 | - * |
|
| 105 | - * @since 20.0.0 |
|
| 106 | - */ |
|
| 107 | - public function registerServiceAlias(string $alias, string $target): void; |
|
| 96 | + /** |
|
| 97 | + * @param string $alias |
|
| 98 | + * @psalm-param string|class-string $alias |
|
| 99 | + * @param string $target |
|
| 100 | + * @psalm-param string|class-string $target |
|
| 101 | + * |
|
| 102 | + * @return void |
|
| 103 | + * @see IContainer::registerAlias() |
|
| 104 | + * |
|
| 105 | + * @since 20.0.0 |
|
| 106 | + */ |
|
| 107 | + public function registerServiceAlias(string $alias, string $target): void; |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * @param string $name |
|
| 111 | - * @param mixed $value |
|
| 112 | - * |
|
| 113 | - * @return void |
|
| 114 | - * @see IContainer::registerParameter() |
|
| 115 | - * |
|
| 116 | - * @since 20.0.0 |
|
| 117 | - */ |
|
| 118 | - public function registerParameter(string $name, $value): void; |
|
| 109 | + /** |
|
| 110 | + * @param string $name |
|
| 111 | + * @param mixed $value |
|
| 112 | + * |
|
| 113 | + * @return void |
|
| 114 | + * @see IContainer::registerParameter() |
|
| 115 | + * |
|
| 116 | + * @since 20.0.0 |
|
| 117 | + */ |
|
| 118 | + public function registerParameter(string $name, $value): void; |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * Register a service listener |
|
| 122 | - * |
|
| 123 | - * This is equivalent to calling IEventDispatcher::addServiceListener |
|
| 124 | - * |
|
| 125 | - * @psalm-template T of \OCP\EventDispatcher\Event |
|
| 126 | - * @param string $event preferably the fully-qualified class name of the Event sub class to listen for |
|
| 127 | - * @psalm-param string|class-string<T> $event preferably the fully-qualified class name of the Event sub class to listen for |
|
| 128 | - * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
| 129 | - * @psalm-param class-string<\OCP\EventDispatcher\IEventListener> $listener fully qualified class name that can be built by the DI container |
|
| 130 | - * @param int $priority The higher this value, the earlier an event |
|
| 131 | - * listener will be triggered in the chain (defaults to 0) |
|
| 132 | - * |
|
| 133 | - * @see IEventDispatcher::addServiceListener() |
|
| 134 | - * |
|
| 135 | - * @since 20.0.0 |
|
| 136 | - */ |
|
| 137 | - public function registerEventListener(string $event, string $listener, int $priority = 0): void; |
|
| 120 | + /** |
|
| 121 | + * Register a service listener |
|
| 122 | + * |
|
| 123 | + * This is equivalent to calling IEventDispatcher::addServiceListener |
|
| 124 | + * |
|
| 125 | + * @psalm-template T of \OCP\EventDispatcher\Event |
|
| 126 | + * @param string $event preferably the fully-qualified class name of the Event sub class to listen for |
|
| 127 | + * @psalm-param string|class-string<T> $event preferably the fully-qualified class name of the Event sub class to listen for |
|
| 128 | + * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
| 129 | + * @psalm-param class-string<\OCP\EventDispatcher\IEventListener> $listener fully qualified class name that can be built by the DI container |
|
| 130 | + * @param int $priority The higher this value, the earlier an event |
|
| 131 | + * listener will be triggered in the chain (defaults to 0) |
|
| 132 | + * |
|
| 133 | + * @see IEventDispatcher::addServiceListener() |
|
| 134 | + * |
|
| 135 | + * @since 20.0.0 |
|
| 136 | + */ |
|
| 137 | + public function registerEventListener(string $event, string $listener, int $priority = 0): void; |
|
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * @param string $class |
|
| 141 | - * @psalm-param class-string<\OCP\AppFramework\Middleware> $class |
|
| 142 | - * |
|
| 143 | - * @return void |
|
| 144 | - * @see IAppContainer::registerMiddleWare() |
|
| 145 | - * |
|
| 146 | - * @since 20.0.0 |
|
| 147 | - */ |
|
| 148 | - public function registerMiddleware(string $class): void; |
|
| 139 | + /** |
|
| 140 | + * @param string $class |
|
| 141 | + * @psalm-param class-string<\OCP\AppFramework\Middleware> $class |
|
| 142 | + * |
|
| 143 | + * @return void |
|
| 144 | + * @see IAppContainer::registerMiddleWare() |
|
| 145 | + * |
|
| 146 | + * @since 20.0.0 |
|
| 147 | + */ |
|
| 148 | + public function registerMiddleware(string $class): void; |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Register a search provider for the unified search |
|
| 152 | - * |
|
| 153 | - * It is allowed to register more than one provider per app as the search |
|
| 154 | - * results can go into distinct sections, e.g. "Files" and "Files shared |
|
| 155 | - * with you" in the Files app. |
|
| 156 | - * |
|
| 157 | - * @param string $class |
|
| 158 | - * @psalm-param class-string<\OCP\Search\IProvider> $class |
|
| 159 | - * |
|
| 160 | - * @return void |
|
| 161 | - * |
|
| 162 | - * @since 20.0.0 |
|
| 163 | - */ |
|
| 164 | - public function registerSearchProvider(string $class): void; |
|
| 150 | + /** |
|
| 151 | + * Register a search provider for the unified search |
|
| 152 | + * |
|
| 153 | + * It is allowed to register more than one provider per app as the search |
|
| 154 | + * results can go into distinct sections, e.g. "Files" and "Files shared |
|
| 155 | + * with you" in the Files app. |
|
| 156 | + * |
|
| 157 | + * @param string $class |
|
| 158 | + * @psalm-param class-string<\OCP\Search\IProvider> $class |
|
| 159 | + * |
|
| 160 | + * @return void |
|
| 161 | + * |
|
| 162 | + * @since 20.0.0 |
|
| 163 | + */ |
|
| 164 | + public function registerSearchProvider(string $class): void; |
|
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Register an alternative login option |
|
| 168 | - * |
|
| 169 | - * It is allowed to register more than one option per app. |
|
| 170 | - * |
|
| 171 | - * @param string $class |
|
| 172 | - * @psalm-param class-string<\OCP\Authentication\IAlternativeLogin> $class |
|
| 173 | - * |
|
| 174 | - * @return void |
|
| 175 | - * |
|
| 176 | - * @since 20.0.0 |
|
| 177 | - */ |
|
| 178 | - public function registerAlternativeLogin(string $class): void; |
|
| 166 | + /** |
|
| 167 | + * Register an alternative login option |
|
| 168 | + * |
|
| 169 | + * It is allowed to register more than one option per app. |
|
| 170 | + * |
|
| 171 | + * @param string $class |
|
| 172 | + * @psalm-param class-string<\OCP\Authentication\IAlternativeLogin> $class |
|
| 173 | + * |
|
| 174 | + * @return void |
|
| 175 | + * |
|
| 176 | + * @since 20.0.0 |
|
| 177 | + */ |
|
| 178 | + public function registerAlternativeLogin(string $class): void; |
|
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Register an initialstate provider |
|
| 182 | - * |
|
| 183 | - * It is allowed to register more than one provider per app. |
|
| 184 | - * |
|
| 185 | - * @param string $class |
|
| 186 | - * @psalm-param class-string<\OCP\AppFramework\Services\InitialStateProvider> $class |
|
| 187 | - * |
|
| 188 | - * @return void |
|
| 189 | - * |
|
| 190 | - * @since 21.0.0 |
|
| 191 | - */ |
|
| 192 | - public function registerInitialStateProvider(string $class): void; |
|
| 180 | + /** |
|
| 181 | + * Register an initialstate provider |
|
| 182 | + * |
|
| 183 | + * It is allowed to register more than one provider per app. |
|
| 184 | + * |
|
| 185 | + * @param string $class |
|
| 186 | + * @psalm-param class-string<\OCP\AppFramework\Services\InitialStateProvider> $class |
|
| 187 | + * |
|
| 188 | + * @return void |
|
| 189 | + * |
|
| 190 | + * @since 21.0.0 |
|
| 191 | + */ |
|
| 192 | + public function registerInitialStateProvider(string $class): void; |
|
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * Register a well known protocol handler |
|
| 196 | - * |
|
| 197 | - * It is allowed to register more than one handler per app. |
|
| 198 | - * |
|
| 199 | - * @param string $class |
|
| 200 | - * @psalm-param class-string<\OCP\Http\WellKnown\IHandler> $class |
|
| 201 | - * |
|
| 202 | - * @return void |
|
| 203 | - * |
|
| 204 | - * @since 21.0.0 |
|
| 205 | - */ |
|
| 206 | - public function registerWellKnownHandler(string $class): void; |
|
| 194 | + /** |
|
| 195 | + * Register a well known protocol handler |
|
| 196 | + * |
|
| 197 | + * It is allowed to register more than one handler per app. |
|
| 198 | + * |
|
| 199 | + * @param string $class |
|
| 200 | + * @psalm-param class-string<\OCP\Http\WellKnown\IHandler> $class |
|
| 201 | + * |
|
| 202 | + * @return void |
|
| 203 | + * |
|
| 204 | + * @since 21.0.0 |
|
| 205 | + */ |
|
| 206 | + public function registerWellKnownHandler(string $class): void; |
|
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Register a custom template provider class that is able to inject custom templates |
|
| 210 | - * in addition to the user defined ones |
|
| 211 | - * |
|
| 212 | - * @param string $providerClass |
|
| 213 | - * @psalm-param class-string<ICustomTemplateProvider> $providerClass |
|
| 214 | - * @since 21.0.0 |
|
| 215 | - */ |
|
| 216 | - public function registerTemplateProvider(string $providerClass): void; |
|
| 208 | + /** |
|
| 209 | + * Register a custom template provider class that is able to inject custom templates |
|
| 210 | + * in addition to the user defined ones |
|
| 211 | + * |
|
| 212 | + * @param string $providerClass |
|
| 213 | + * @psalm-param class-string<ICustomTemplateProvider> $providerClass |
|
| 214 | + * @since 21.0.0 |
|
| 215 | + */ |
|
| 216 | + public function registerTemplateProvider(string $providerClass): void; |
|
| 217 | 217 | |
| 218 | - /** |
|
| 219 | - * Register an INotifier class |
|
| 220 | - * |
|
| 221 | - * @param string $notifierClass |
|
| 222 | - * @psalm-param class-string<INotifier> $notifierClass |
|
| 223 | - * @since 22.0.0 |
|
| 224 | - */ |
|
| 225 | - public function registerNotifierService(string $notifierClass): void; |
|
| 218 | + /** |
|
| 219 | + * Register an INotifier class |
|
| 220 | + * |
|
| 221 | + * @param string $notifierClass |
|
| 222 | + * @psalm-param class-string<INotifier> $notifierClass |
|
| 223 | + * @since 22.0.0 |
|
| 224 | + */ |
|
| 225 | + public function registerNotifierService(string $notifierClass): void; |
|
| 226 | 226 | |
| 227 | - /** |
|
| 228 | - * Register a two-factor provider |
|
| 229 | - * |
|
| 230 | - * @param string $twoFactorProviderClass |
|
| 231 | - * @psalm-param class-string<IProvider> $twoFactorProviderClass |
|
| 232 | - * @since 22.0.0 |
|
| 233 | - */ |
|
| 234 | - public function registerTwoFactorProvider(string $twoFactorProviderClass): void; |
|
| 227 | + /** |
|
| 228 | + * Register a two-factor provider |
|
| 229 | + * |
|
| 230 | + * @param string $twoFactorProviderClass |
|
| 231 | + * @psalm-param class-string<IProvider> $twoFactorProviderClass |
|
| 232 | + * @since 22.0.0 |
|
| 233 | + */ |
|
| 234 | + public function registerTwoFactorProvider(string $twoFactorProviderClass): void; |
|
| 235 | 235 | |
| 236 | - /** |
|
| 237 | - * Register a preview provider |
|
| 238 | - * |
|
| 239 | - * It is allowed to register more than one provider per app. |
|
| 240 | - * |
|
| 241 | - * @param string $previewProviderClass |
|
| 242 | - * @param string $mimeTypeRegex |
|
| 243 | - * @psalm-param class-string<IProviderV2> $previewProviderClass |
|
| 244 | - * @since 23.0.0 |
|
| 245 | - */ |
|
| 246 | - public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void; |
|
| 236 | + /** |
|
| 237 | + * Register a preview provider |
|
| 238 | + * |
|
| 239 | + * It is allowed to register more than one provider per app. |
|
| 240 | + * |
|
| 241 | + * @param string $previewProviderClass |
|
| 242 | + * @param string $mimeTypeRegex |
|
| 243 | + * @psalm-param class-string<IProviderV2> $previewProviderClass |
|
| 244 | + * @since 23.0.0 |
|
| 245 | + */ |
|
| 246 | + public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void; |
|
| 247 | 247 | |
| 248 | - /** |
|
| 249 | - * Register a calendar provider |
|
| 250 | - * |
|
| 251 | - * @param string $class |
|
| 252 | - * @psalm-param class-string<ICalendarProvider> $class |
|
| 253 | - * @since 23.0.0 |
|
| 254 | - */ |
|
| 255 | - public function registerCalendarProvider(string $class): void; |
|
| 248 | + /** |
|
| 249 | + * Register a calendar provider |
|
| 250 | + * |
|
| 251 | + * @param string $class |
|
| 252 | + * @psalm-param class-string<ICalendarProvider> $class |
|
| 253 | + * @since 23.0.0 |
|
| 254 | + */ |
|
| 255 | + public function registerCalendarProvider(string $class): void; |
|
| 256 | 256 | |
| 257 | - /** |
|
| 258 | - * Register an implementation of \OCP\Profile\ILinkAction that |
|
| 259 | - * will handle the implementation of a profile link action |
|
| 260 | - * |
|
| 261 | - * @param string $actionClass |
|
| 262 | - * @psalm-param class-string<\OCP\Profile\ILinkAction> $actionClass |
|
| 263 | - * @return void |
|
| 264 | - * @since 23.0.0 |
|
| 265 | - */ |
|
| 266 | - public function registerProfileLinkAction(string $actionClass): void; |
|
| 257 | + /** |
|
| 258 | + * Register an implementation of \OCP\Profile\ILinkAction that |
|
| 259 | + * will handle the implementation of a profile link action |
|
| 260 | + * |
|
| 261 | + * @param string $actionClass |
|
| 262 | + * @psalm-param class-string<\OCP\Profile\ILinkAction> $actionClass |
|
| 263 | + * @return void |
|
| 264 | + * @since 23.0.0 |
|
| 265 | + */ |
|
| 266 | + public function registerProfileLinkAction(string $actionClass): void; |
|
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Register the backend of the Talk app |
|
| 270 | - * |
|
| 271 | - * This service must only be used by the Talk app |
|
| 272 | - * |
|
| 273 | - * @param string $backend |
|
| 274 | - * @return void |
|
| 275 | - * @since 24.0.0 |
|
| 276 | - */ |
|
| 277 | - public function registerTalkBackend(string $backend): void; |
|
| 268 | + /** |
|
| 269 | + * Register the backend of the Talk app |
|
| 270 | + * |
|
| 271 | + * This service must only be used by the Talk app |
|
| 272 | + * |
|
| 273 | + * @param string $backend |
|
| 274 | + * @return void |
|
| 275 | + * @since 24.0.0 |
|
| 276 | + */ |
|
| 277 | + public function registerTalkBackend(string $backend): void; |
|
| 278 | 278 | |
| 279 | - /** |
|
| 280 | - * Register a resource backend for the DAV server |
|
| 281 | - * |
|
| 282 | - * @param string $actionClass |
|
| 283 | - * @psalm-param class-string<\OCP\Calendar\Resource\IBackend> $actionClass |
|
| 284 | - * @return void |
|
| 285 | - * @since 24.0.0 |
|
| 286 | - */ |
|
| 287 | - public function registerCalendarResourceBackend(string $class): void; |
|
| 279 | + /** |
|
| 280 | + * Register a resource backend for the DAV server |
|
| 281 | + * |
|
| 282 | + * @param string $actionClass |
|
| 283 | + * @psalm-param class-string<\OCP\Calendar\Resource\IBackend> $actionClass |
|
| 284 | + * @return void |
|
| 285 | + * @since 24.0.0 |
|
| 286 | + */ |
|
| 287 | + public function registerCalendarResourceBackend(string $class): void; |
|
| 288 | 288 | |
| 289 | - /** |
|
| 290 | - * Register a room backend for the DAV server |
|
| 291 | - * |
|
| 292 | - * @param string $actionClass |
|
| 293 | - * @psalm-param class-string<\OCP\Calendar\Room\IBackend> $actionClass |
|
| 294 | - * @return void |
|
| 295 | - * @since 24.0.0 |
|
| 296 | - */ |
|
| 297 | - public function registerCalendarRoomBackend(string $class): void; |
|
| 289 | + /** |
|
| 290 | + * Register a room backend for the DAV server |
|
| 291 | + * |
|
| 292 | + * @param string $actionClass |
|
| 293 | + * @psalm-param class-string<\OCP\Calendar\Room\IBackend> $actionClass |
|
| 294 | + * @return void |
|
| 295 | + * @since 24.0.0 |
|
| 296 | + */ |
|
| 297 | + public function registerCalendarRoomBackend(string $class): void; |
|
| 298 | 298 | } |