@@ -28,22 +28,22 @@ |
||
28 | 28 | use OCP\Talk\IConversationOptions; |
29 | 29 | |
30 | 30 | class ConversationOptions implements IConversationOptions { |
31 | - private bool $isPublic; |
|
31 | + private bool $isPublic; |
|
32 | 32 | |
33 | - private function __construct(bool $isPublic) { |
|
34 | - $this->isPublic = $isPublic; |
|
35 | - } |
|
33 | + private function __construct(bool $isPublic) { |
|
34 | + $this->isPublic = $isPublic; |
|
35 | + } |
|
36 | 36 | |
37 | - public static function default(): self { |
|
38 | - return new self(false); |
|
39 | - } |
|
37 | + public static function default(): self { |
|
38 | + return new self(false); |
|
39 | + } |
|
40 | 40 | |
41 | - public function setPublic(bool $isPublic = true): IConversationOptions { |
|
42 | - $this->isPublic = $isPublic; |
|
43 | - return $this; |
|
44 | - } |
|
41 | + public function setPublic(bool $isPublic = true): IConversationOptions { |
|
42 | + $this->isPublic = $isPublic; |
|
43 | + return $this; |
|
44 | + } |
|
45 | 45 | |
46 | - public function isPublic(): bool { |
|
47 | - return $this->isPublic; |
|
48 | - } |
|
46 | + public function isPublic(): bool { |
|
47 | + return $this->isPublic; |
|
48 | + } |
|
49 | 49 | } |
@@ -37,73 +37,73 @@ |
||
37 | 37 | use Throwable; |
38 | 38 | |
39 | 39 | class Broker implements IBroker { |
40 | - private Coordinator $coordinator; |
|
41 | - |
|
42 | - private IServerContainer $container; |
|
43 | - |
|
44 | - private LoggerInterface $logger; |
|
45 | - |
|
46 | - private ?bool $hasBackend = null; |
|
47 | - |
|
48 | - private ?ITalkBackend $backend = null; |
|
49 | - |
|
50 | - public function __construct(Coordinator $coordinator, |
|
51 | - IServerContainer $container, |
|
52 | - LoggerInterface $logger) { |
|
53 | - $this->coordinator = $coordinator; |
|
54 | - $this->container = $container; |
|
55 | - $this->logger = $logger; |
|
56 | - } |
|
57 | - |
|
58 | - public function hasBackend(): bool { |
|
59 | - if ($this->hasBackend !== null) { |
|
60 | - return $this->hasBackend; |
|
61 | - } |
|
62 | - |
|
63 | - $context = $this->coordinator->getRegistrationContext(); |
|
64 | - if ($context === null) { |
|
65 | - // Backend requested too soon, e.g. from the bootstrap `register` method of an app |
|
66 | - throw new RuntimeException("Not all apps have been registered yet"); |
|
67 | - } |
|
68 | - $backendRegistration = $context->getTalkBackendRegistration(); |
|
69 | - if ($backendRegistration === null) { |
|
70 | - // Nothing to do. Remember and exit. |
|
71 | - return $this->hasBackend = false; |
|
72 | - } |
|
73 | - |
|
74 | - try { |
|
75 | - $this->backend = $this->container->get( |
|
76 | - $backendRegistration->getService() |
|
77 | - ); |
|
78 | - |
|
79 | - // Remember and return |
|
80 | - return $this->hasBackend = true; |
|
81 | - } catch (Throwable $e) { |
|
82 | - $this->logger->error("Talk backend {class} could not be loaded: " . $e->getMessage(), [ |
|
83 | - 'class' => $backendRegistration->getService(), |
|
84 | - 'exception' => $e, |
|
85 | - ]); |
|
86 | - |
|
87 | - // Temporary result. Maybe the next time the backend is requested it can be loaded. |
|
88 | - return false; |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - public function newConversationOptions(): IConversationOptions { |
|
93 | - return ConversationOptions::default(); |
|
94 | - } |
|
95 | - |
|
96 | - public function createConversation(string $name, |
|
97 | - array $moderators, |
|
98 | - IConversationOptions $options = null): IConversation { |
|
99 | - if (!$this->hasBackend()) { |
|
100 | - throw new NoBackendException("The Talk broker has no registered backend"); |
|
101 | - } |
|
102 | - |
|
103 | - return $this->backend->createConversation( |
|
104 | - $name, |
|
105 | - $moderators, |
|
106 | - $options ?? ConversationOptions::default() |
|
107 | - ); |
|
108 | - } |
|
40 | + private Coordinator $coordinator; |
|
41 | + |
|
42 | + private IServerContainer $container; |
|
43 | + |
|
44 | + private LoggerInterface $logger; |
|
45 | + |
|
46 | + private ?bool $hasBackend = null; |
|
47 | + |
|
48 | + private ?ITalkBackend $backend = null; |
|
49 | + |
|
50 | + public function __construct(Coordinator $coordinator, |
|
51 | + IServerContainer $container, |
|
52 | + LoggerInterface $logger) { |
|
53 | + $this->coordinator = $coordinator; |
|
54 | + $this->container = $container; |
|
55 | + $this->logger = $logger; |
|
56 | + } |
|
57 | + |
|
58 | + public function hasBackend(): bool { |
|
59 | + if ($this->hasBackend !== null) { |
|
60 | + return $this->hasBackend; |
|
61 | + } |
|
62 | + |
|
63 | + $context = $this->coordinator->getRegistrationContext(); |
|
64 | + if ($context === null) { |
|
65 | + // Backend requested too soon, e.g. from the bootstrap `register` method of an app |
|
66 | + throw new RuntimeException("Not all apps have been registered yet"); |
|
67 | + } |
|
68 | + $backendRegistration = $context->getTalkBackendRegistration(); |
|
69 | + if ($backendRegistration === null) { |
|
70 | + // Nothing to do. Remember and exit. |
|
71 | + return $this->hasBackend = false; |
|
72 | + } |
|
73 | + |
|
74 | + try { |
|
75 | + $this->backend = $this->container->get( |
|
76 | + $backendRegistration->getService() |
|
77 | + ); |
|
78 | + |
|
79 | + // Remember and return |
|
80 | + return $this->hasBackend = true; |
|
81 | + } catch (Throwable $e) { |
|
82 | + $this->logger->error("Talk backend {class} could not be loaded: " . $e->getMessage(), [ |
|
83 | + 'class' => $backendRegistration->getService(), |
|
84 | + 'exception' => $e, |
|
85 | + ]); |
|
86 | + |
|
87 | + // Temporary result. Maybe the next time the backend is requested it can be loaded. |
|
88 | + return false; |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + public function newConversationOptions(): IConversationOptions { |
|
93 | + return ConversationOptions::default(); |
|
94 | + } |
|
95 | + |
|
96 | + public function createConversation(string $name, |
|
97 | + array $moderators, |
|
98 | + IConversationOptions $options = null): IConversation { |
|
99 | + if (!$this->hasBackend()) { |
|
100 | + throw new NoBackendException("The Talk broker has no registered backend"); |
|
101 | + } |
|
102 | + |
|
103 | + return $this->backend->createConversation( |
|
104 | + $name, |
|
105 | + $moderators, |
|
106 | + $options ?? ConversationOptions::default() |
|
107 | + ); |
|
108 | + } |
|
109 | 109 | } |
@@ -79,7 +79,7 @@ |
||
79 | 79 | // Remember and return |
80 | 80 | return $this->hasBackend = true; |
81 | 81 | } catch (Throwable $e) { |
82 | - $this->logger->error("Talk backend {class} could not be loaded: " . $e->getMessage(), [ |
|
82 | + $this->logger->error("Talk backend {class} could not be loaded: ".$e->getMessage(), [ |
|
83 | 83 | 'class' => $backendRegistration->getService(), |
84 | 84 | 'exception' => $e, |
85 | 85 | ]); |
@@ -55,584 +55,584 @@ |
||
55 | 55 | |
56 | 56 | class RegistrationContext { |
57 | 57 | |
58 | - /** @var ServiceRegistration<ICapability>[] */ |
|
59 | - private $capabilities = []; |
|
58 | + /** @var ServiceRegistration<ICapability>[] */ |
|
59 | + private $capabilities = []; |
|
60 | 60 | |
61 | - /** @var ServiceRegistration<IReporter>[] */ |
|
62 | - private $crashReporters = []; |
|
61 | + /** @var ServiceRegistration<IReporter>[] */ |
|
62 | + private $crashReporters = []; |
|
63 | 63 | |
64 | - /** @var ServiceRegistration<IWidget>[] */ |
|
65 | - private $dashboardPanels = []; |
|
64 | + /** @var ServiceRegistration<IWidget>[] */ |
|
65 | + private $dashboardPanels = []; |
|
66 | 66 | |
67 | - /** @var ServiceRegistration<ILinkAction>[] */ |
|
68 | - private $profileLinkActions = []; |
|
67 | + /** @var ServiceRegistration<ILinkAction>[] */ |
|
68 | + private $profileLinkActions = []; |
|
69 | 69 | |
70 | - /** @var null|ServiceRegistration<ITalkBackend> */ |
|
71 | - private $talkBackendRegistration = null; |
|
70 | + /** @var null|ServiceRegistration<ITalkBackend> */ |
|
71 | + private $talkBackendRegistration = null; |
|
72 | 72 | |
73 | - /** @var ServiceFactoryRegistration[] */ |
|
74 | - private $services = []; |
|
73 | + /** @var ServiceFactoryRegistration[] */ |
|
74 | + private $services = []; |
|
75 | 75 | |
76 | - /** @var ServiceAliasRegistration[] */ |
|
77 | - private $aliases = []; |
|
78 | - |
|
79 | - /** @var ParameterRegistration[] */ |
|
80 | - private $parameters = []; |
|
81 | - |
|
82 | - /** @var EventListenerRegistration[] */ |
|
83 | - private $eventListeners = []; |
|
84 | - |
|
85 | - /** @var ServiceRegistration<Middleware>[] */ |
|
86 | - private $middlewares = []; |
|
87 | - |
|
88 | - /** @var ServiceRegistration<IProvider>[] */ |
|
89 | - private $searchProviders = []; |
|
90 | - |
|
91 | - /** @var ServiceRegistration<IAlternativeLogin>[] */ |
|
92 | - private $alternativeLogins = []; |
|
93 | - |
|
94 | - /** @var ServiceRegistration<InitialStateProvider>[] */ |
|
95 | - private $initialStates = []; |
|
96 | - |
|
97 | - /** @var ServiceRegistration<IHandler>[] */ |
|
98 | - private $wellKnownHandlers = []; |
|
99 | - |
|
100 | - /** @var ServiceRegistration<ICustomTemplateProvider>[] */ |
|
101 | - private $templateProviders = []; |
|
102 | - |
|
103 | - /** @var ServiceRegistration<INotifier>[] */ |
|
104 | - private $notifierServices = []; |
|
105 | - |
|
106 | - /** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */ |
|
107 | - private $twoFactorProviders = []; |
|
108 | - |
|
109 | - /** @var ServiceRegistration<ICalendarProvider>[] */ |
|
110 | - private $calendarProviders = []; |
|
111 | - |
|
112 | - /** @var LoggerInterface */ |
|
113 | - private $logger; |
|
114 | - |
|
115 | - /** @var PreviewProviderRegistration[] */ |
|
116 | - private $previewProviders = []; |
|
117 | - |
|
118 | - public function __construct(LoggerInterface $logger) { |
|
119 | - $this->logger = $logger; |
|
120 | - } |
|
121 | - |
|
122 | - public function for(string $appId): IRegistrationContext { |
|
123 | - return new class($appId, $this) implements IRegistrationContext { |
|
124 | - /** @var string */ |
|
125 | - private $appId; |
|
126 | - |
|
127 | - /** @var RegistrationContext */ |
|
128 | - private $context; |
|
129 | - |
|
130 | - public function __construct(string $appId, RegistrationContext $context) { |
|
131 | - $this->appId = $appId; |
|
132 | - $this->context = $context; |
|
133 | - } |
|
134 | - |
|
135 | - public function registerCapability(string $capability): void { |
|
136 | - $this->context->registerCapability( |
|
137 | - $this->appId, |
|
138 | - $capability |
|
139 | - ); |
|
140 | - } |
|
141 | - |
|
142 | - public function registerCrashReporter(string $reporterClass): void { |
|
143 | - $this->context->registerCrashReporter( |
|
144 | - $this->appId, |
|
145 | - $reporterClass |
|
146 | - ); |
|
147 | - } |
|
148 | - |
|
149 | - public function registerDashboardWidget(string $widgetClass): void { |
|
150 | - $this->context->registerDashboardPanel( |
|
151 | - $this->appId, |
|
152 | - $widgetClass |
|
153 | - ); |
|
154 | - } |
|
155 | - |
|
156 | - public function registerService(string $name, callable $factory, bool $shared = true): void { |
|
157 | - $this->context->registerService( |
|
158 | - $this->appId, |
|
159 | - $name, |
|
160 | - $factory, |
|
161 | - $shared |
|
162 | - ); |
|
163 | - } |
|
164 | - |
|
165 | - public function registerServiceAlias(string $alias, string $target): void { |
|
166 | - $this->context->registerServiceAlias( |
|
167 | - $this->appId, |
|
168 | - $alias, |
|
169 | - $target |
|
170 | - ); |
|
171 | - } |
|
172 | - |
|
173 | - public function registerParameter(string $name, $value): void { |
|
174 | - $this->context->registerParameter( |
|
175 | - $this->appId, |
|
176 | - $name, |
|
177 | - $value |
|
178 | - ); |
|
179 | - } |
|
180 | - |
|
181 | - public function registerEventListener(string $event, string $listener, int $priority = 0): void { |
|
182 | - $this->context->registerEventListener( |
|
183 | - $this->appId, |
|
184 | - $event, |
|
185 | - $listener, |
|
186 | - $priority |
|
187 | - ); |
|
188 | - } |
|
189 | - |
|
190 | - public function registerMiddleware(string $class): void { |
|
191 | - $this->context->registerMiddleware( |
|
192 | - $this->appId, |
|
193 | - $class |
|
194 | - ); |
|
195 | - } |
|
196 | - |
|
197 | - public function registerSearchProvider(string $class): void { |
|
198 | - $this->context->registerSearchProvider( |
|
199 | - $this->appId, |
|
200 | - $class |
|
201 | - ); |
|
202 | - } |
|
203 | - |
|
204 | - public function registerAlternativeLogin(string $class): void { |
|
205 | - $this->context->registerAlternativeLogin( |
|
206 | - $this->appId, |
|
207 | - $class |
|
208 | - ); |
|
209 | - } |
|
210 | - |
|
211 | - public function registerInitialStateProvider(string $class): void { |
|
212 | - $this->context->registerInitialState( |
|
213 | - $this->appId, |
|
214 | - $class |
|
215 | - ); |
|
216 | - } |
|
217 | - |
|
218 | - public function registerWellKnownHandler(string $class): void { |
|
219 | - $this->context->registerWellKnown( |
|
220 | - $this->appId, |
|
221 | - $class |
|
222 | - ); |
|
223 | - } |
|
224 | - |
|
225 | - public function registerTemplateProvider(string $providerClass): void { |
|
226 | - $this->context->registerTemplateProvider( |
|
227 | - $this->appId, |
|
228 | - $providerClass |
|
229 | - ); |
|
230 | - } |
|
231 | - |
|
232 | - public function registerNotifierService(string $notifierClass): void { |
|
233 | - $this->context->registerNotifierService( |
|
234 | - $this->appId, |
|
235 | - $notifierClass |
|
236 | - ); |
|
237 | - } |
|
238 | - |
|
239 | - public function registerTwoFactorProvider(string $twoFactorProviderClass): void { |
|
240 | - $this->context->registerTwoFactorProvider( |
|
241 | - $this->appId, |
|
242 | - $twoFactorProviderClass |
|
243 | - ); |
|
244 | - } |
|
245 | - |
|
246 | - public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void { |
|
247 | - $this->context->registerPreviewProvider( |
|
248 | - $this->appId, |
|
249 | - $previewProviderClass, |
|
250 | - $mimeTypeRegex |
|
251 | - ); |
|
252 | - } |
|
253 | - |
|
254 | - public function registerCalendarProvider(string $class): void { |
|
255 | - $this->context->registerCalendarProvider( |
|
256 | - $this->appId, |
|
257 | - $class |
|
258 | - ); |
|
259 | - } |
|
260 | - |
|
261 | - public function registerProfileLinkAction(string $actionClass): void { |
|
262 | - $this->context->registerProfileLinkAction( |
|
263 | - $this->appId, |
|
264 | - $actionClass |
|
265 | - ); |
|
266 | - } |
|
267 | - |
|
268 | - public function registerTalkBackend(string $backend): void { |
|
269 | - $this->context->registerTalkBackend( |
|
270 | - $this->appId, |
|
271 | - $backend |
|
272 | - ); |
|
273 | - } |
|
274 | - }; |
|
275 | - } |
|
276 | - |
|
277 | - /** |
|
278 | - * @psalm-param class-string<ICapability> $capability |
|
279 | - */ |
|
280 | - public function registerCapability(string $appId, string $capability): void { |
|
281 | - $this->capabilities[] = new ServiceRegistration($appId, $capability); |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * @psalm-param class-string<IReporter> $capability |
|
286 | - */ |
|
287 | - public function registerCrashReporter(string $appId, string $reporterClass): void { |
|
288 | - $this->crashReporters[] = new ServiceRegistration($appId, $reporterClass); |
|
289 | - } |
|
290 | - |
|
291 | - /** |
|
292 | - * @psalm-param class-string<IWidget> $capability |
|
293 | - */ |
|
294 | - public function registerDashboardPanel(string $appId, string $panelClass): void { |
|
295 | - $this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass); |
|
296 | - } |
|
297 | - |
|
298 | - public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void { |
|
299 | - $this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared); |
|
300 | - } |
|
301 | - |
|
302 | - public function registerServiceAlias(string $appId, string $alias, string $target): void { |
|
303 | - $this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target); |
|
304 | - } |
|
305 | - |
|
306 | - public function registerParameter(string $appId, string $name, $value): void { |
|
307 | - $this->parameters[] = new ParameterRegistration($appId, $name, $value); |
|
308 | - } |
|
309 | - |
|
310 | - public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void { |
|
311 | - $this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority); |
|
312 | - } |
|
313 | - |
|
314 | - /** |
|
315 | - * @psalm-param class-string<Middleware> $class |
|
316 | - */ |
|
317 | - public function registerMiddleware(string $appId, string $class): void { |
|
318 | - $this->middlewares[] = new ServiceRegistration($appId, $class); |
|
319 | - } |
|
320 | - |
|
321 | - public function registerSearchProvider(string $appId, string $class) { |
|
322 | - $this->searchProviders[] = new ServiceRegistration($appId, $class); |
|
323 | - } |
|
324 | - |
|
325 | - public function registerAlternativeLogin(string $appId, string $class): void { |
|
326 | - $this->alternativeLogins[] = new ServiceRegistration($appId, $class); |
|
327 | - } |
|
328 | - |
|
329 | - public function registerInitialState(string $appId, string $class): void { |
|
330 | - $this->initialStates[] = new ServiceRegistration($appId, $class); |
|
331 | - } |
|
332 | - |
|
333 | - public function registerWellKnown(string $appId, string $class): void { |
|
334 | - $this->wellKnownHandlers[] = new ServiceRegistration($appId, $class); |
|
335 | - } |
|
336 | - |
|
337 | - public function registerTemplateProvider(string $appId, string $class): void { |
|
338 | - $this->templateProviders[] = new ServiceRegistration($appId, $class); |
|
339 | - } |
|
340 | - |
|
341 | - public function registerNotifierService(string $appId, string $class): void { |
|
342 | - $this->notifierServices[] = new ServiceRegistration($appId, $class); |
|
343 | - } |
|
344 | - |
|
345 | - public function registerTwoFactorProvider(string $appId, string $class): void { |
|
346 | - $this->twoFactorProviders[] = new ServiceRegistration($appId, $class); |
|
347 | - } |
|
348 | - |
|
349 | - public function registerPreviewProvider(string $appId, string $class, string $mimeTypeRegex): void { |
|
350 | - $this->previewProviders[] = new PreviewProviderRegistration($appId, $class, $mimeTypeRegex); |
|
351 | - } |
|
352 | - |
|
353 | - public function registerCalendarProvider(string $appId, string $class): void { |
|
354 | - $this->calendarProviders[] = new ServiceRegistration($appId, $class); |
|
355 | - } |
|
356 | - |
|
357 | - /** |
|
358 | - * @psalm-param class-string<ILinkAction> $actionClass |
|
359 | - */ |
|
360 | - public function registerProfileLinkAction(string $appId, string $actionClass): void { |
|
361 | - $this->profileLinkActions[] = new ServiceRegistration($appId, $actionClass); |
|
362 | - } |
|
363 | - |
|
364 | - /** |
|
365 | - * @psalm-param class-string<ITalkBackend> $backend |
|
366 | - */ |
|
367 | - public function registerTalkBackend(string $appId, string $backend) { |
|
368 | - // Some safeguards for invalid registrations |
|
369 | - if ($appId !== 'spreed') { |
|
370 | - throw new RuntimeException("Only the Talk app is allowed to register a Talk backend"); |
|
371 | - } |
|
372 | - if ($this->talkBackendRegistration !== null) { |
|
373 | - throw new RuntimeException("There can only be one Talk backend"); |
|
374 | - } |
|
375 | - |
|
376 | - $this->talkBackendRegistration = new ServiceRegistration($appId, $backend); |
|
377 | - } |
|
378 | - |
|
379 | - /** |
|
380 | - * @param App[] $apps |
|
381 | - */ |
|
382 | - public function delegateCapabilityRegistrations(array $apps): void { |
|
383 | - while (($registration = array_shift($this->capabilities)) !== null) { |
|
384 | - $appId = $registration->getAppId(); |
|
385 | - if (!isset($apps[$appId])) { |
|
386 | - // If we land here something really isn't right. But at least we caught the |
|
387 | - // notice that is otherwise emitted for the undefined index |
|
388 | - $this->logger->error("App $appId not loaded for the capability registration"); |
|
389 | - |
|
390 | - continue; |
|
391 | - } |
|
392 | - |
|
393 | - try { |
|
394 | - $apps[$appId] |
|
395 | - ->getContainer() |
|
396 | - ->registerCapability($registration->getService()); |
|
397 | - } catch (Throwable $e) { |
|
398 | - $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
399 | - 'exception' => $e, |
|
400 | - ]); |
|
401 | - } |
|
402 | - } |
|
403 | - } |
|
404 | - |
|
405 | - /** |
|
406 | - * @param App[] $apps |
|
407 | - */ |
|
408 | - public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void { |
|
409 | - while (($registration = array_shift($this->crashReporters)) !== null) { |
|
410 | - try { |
|
411 | - $registry->registerLazy($registration->getService()); |
|
412 | - } catch (Throwable $e) { |
|
413 | - $appId = $registration->getAppId(); |
|
414 | - $this->logger->error("Error during crash reporter registration of $appId: " . $e->getMessage(), [ |
|
415 | - 'exception' => $e, |
|
416 | - ]); |
|
417 | - } |
|
418 | - } |
|
419 | - } |
|
420 | - |
|
421 | - /** |
|
422 | - * @param App[] $apps |
|
423 | - */ |
|
424 | - public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void { |
|
425 | - while (($panel = array_shift($this->dashboardPanels)) !== null) { |
|
426 | - try { |
|
427 | - $dashboardManager->lazyRegisterWidget($panel->getService()); |
|
428 | - } catch (Throwable $e) { |
|
429 | - $appId = $panel->getAppId(); |
|
430 | - $this->logger->error("Error during dashboard registration of $appId: " . $e->getMessage(), [ |
|
431 | - 'exception' => $e, |
|
432 | - ]); |
|
433 | - } |
|
434 | - } |
|
435 | - } |
|
436 | - |
|
437 | - public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void { |
|
438 | - while (($registration = array_shift($this->eventListeners)) !== null) { |
|
439 | - try { |
|
440 | - $eventDispatcher->addServiceListener( |
|
441 | - $registration->getEvent(), |
|
442 | - $registration->getService(), |
|
443 | - $registration->getPriority() |
|
444 | - ); |
|
445 | - } catch (Throwable $e) { |
|
446 | - $appId = $registration->getAppId(); |
|
447 | - $this->logger->error("Error during event listener registration of $appId: " . $e->getMessage(), [ |
|
448 | - 'exception' => $e, |
|
449 | - ]); |
|
450 | - } |
|
451 | - } |
|
452 | - } |
|
453 | - |
|
454 | - /** |
|
455 | - * @param App[] $apps |
|
456 | - */ |
|
457 | - public function delegateContainerRegistrations(array $apps): void { |
|
458 | - while (($registration = array_shift($this->services)) !== null) { |
|
459 | - $appId = $registration->getAppId(); |
|
460 | - if (!isset($apps[$appId])) { |
|
461 | - // If we land here something really isn't right. But at least we caught the |
|
462 | - // notice that is otherwise emitted for the undefined index |
|
463 | - $this->logger->error("App $appId not loaded for the container service registration"); |
|
464 | - |
|
465 | - continue; |
|
466 | - } |
|
467 | - |
|
468 | - try { |
|
469 | - /** |
|
470 | - * Register the service and convert the callable into a \Closure if necessary |
|
471 | - */ |
|
472 | - $apps[$appId] |
|
473 | - ->getContainer() |
|
474 | - ->registerService( |
|
475 | - $registration->getName(), |
|
476 | - Closure::fromCallable($registration->getFactory()), |
|
477 | - $registration->isShared() |
|
478 | - ); |
|
479 | - } catch (Throwable $e) { |
|
480 | - $this->logger->error("Error during service registration of $appId: " . $e->getMessage(), [ |
|
481 | - 'exception' => $e, |
|
482 | - ]); |
|
483 | - } |
|
484 | - } |
|
485 | - |
|
486 | - while (($registration = array_shift($this->aliases)) !== null) { |
|
487 | - $appId = $registration->getAppId(); |
|
488 | - if (!isset($apps[$appId])) { |
|
489 | - // If we land here something really isn't right. But at least we caught the |
|
490 | - // notice that is otherwise emitted for the undefined index |
|
491 | - $this->logger->error("App $appId not loaded for the container alias registration"); |
|
492 | - |
|
493 | - continue; |
|
494 | - } |
|
495 | - |
|
496 | - try { |
|
497 | - $apps[$appId] |
|
498 | - ->getContainer() |
|
499 | - ->registerAlias( |
|
500 | - $registration->getAlias(), |
|
501 | - $registration->getTarget() |
|
502 | - ); |
|
503 | - } catch (Throwable $e) { |
|
504 | - $this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [ |
|
505 | - 'exception' => $e, |
|
506 | - ]); |
|
507 | - } |
|
508 | - } |
|
509 | - |
|
510 | - while (($registration = array_shift($this->parameters)) !== null) { |
|
511 | - $appId = $registration->getAppId(); |
|
512 | - if (!isset($apps[$appId])) { |
|
513 | - // If we land here something really isn't right. But at least we caught the |
|
514 | - // notice that is otherwise emitted for the undefined index |
|
515 | - $this->logger->error("App $appId not loaded for the container parameter registration"); |
|
516 | - |
|
517 | - continue; |
|
518 | - } |
|
519 | - |
|
520 | - try { |
|
521 | - $apps[$appId] |
|
522 | - ->getContainer() |
|
523 | - ->registerParameter( |
|
524 | - $registration->getName(), |
|
525 | - $registration->getValue() |
|
526 | - ); |
|
527 | - } catch (Throwable $e) { |
|
528 | - $this->logger->error("Error during service parameter registration of $appId: " . $e->getMessage(), [ |
|
529 | - 'exception' => $e, |
|
530 | - ]); |
|
531 | - } |
|
532 | - } |
|
533 | - } |
|
534 | - |
|
535 | - /** |
|
536 | - * @param App[] $apps |
|
537 | - */ |
|
538 | - public function delegateMiddlewareRegistrations(array $apps): void { |
|
539 | - while (($middleware = array_shift($this->middlewares)) !== null) { |
|
540 | - $appId = $middleware->getAppId(); |
|
541 | - if (!isset($apps[$appId])) { |
|
542 | - // If we land here something really isn't right. But at least we caught the |
|
543 | - // notice that is otherwise emitted for the undefined index |
|
544 | - $this->logger->error("App $appId not loaded for the container middleware registration"); |
|
545 | - |
|
546 | - continue; |
|
547 | - } |
|
548 | - |
|
549 | - try { |
|
550 | - $apps[$appId] |
|
551 | - ->getContainer() |
|
552 | - ->registerMiddleWare($middleware->getService()); |
|
553 | - } catch (Throwable $e) { |
|
554 | - $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
555 | - 'exception' => $e, |
|
556 | - ]); |
|
557 | - } |
|
558 | - } |
|
559 | - } |
|
560 | - |
|
561 | - /** |
|
562 | - * @return ServiceRegistration<IProvider>[] |
|
563 | - */ |
|
564 | - public function getSearchProviders(): array { |
|
565 | - return $this->searchProviders; |
|
566 | - } |
|
567 | - |
|
568 | - /** |
|
569 | - * @return ServiceRegistration<IAlternativeLogin>[] |
|
570 | - */ |
|
571 | - public function getAlternativeLogins(): array { |
|
572 | - return $this->alternativeLogins; |
|
573 | - } |
|
574 | - |
|
575 | - /** |
|
576 | - * @return ServiceRegistration<InitialStateProvider>[] |
|
577 | - */ |
|
578 | - public function getInitialStates(): array { |
|
579 | - return $this->initialStates; |
|
580 | - } |
|
581 | - |
|
582 | - /** |
|
583 | - * @return ServiceRegistration<IHandler>[] |
|
584 | - */ |
|
585 | - public function getWellKnownHandlers(): array { |
|
586 | - return $this->wellKnownHandlers; |
|
587 | - } |
|
588 | - |
|
589 | - /** |
|
590 | - * @return ServiceRegistration<ICustomTemplateProvider>[] |
|
591 | - */ |
|
592 | - public function getTemplateProviders(): array { |
|
593 | - return $this->templateProviders; |
|
594 | - } |
|
595 | - |
|
596 | - /** |
|
597 | - * @return ServiceRegistration<INotifier>[] |
|
598 | - */ |
|
599 | - public function getNotifierServices(): array { |
|
600 | - return $this->notifierServices; |
|
601 | - } |
|
602 | - |
|
603 | - /** |
|
604 | - * @return ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] |
|
605 | - */ |
|
606 | - public function getTwoFactorProviders(): array { |
|
607 | - return $this->twoFactorProviders; |
|
608 | - } |
|
609 | - |
|
610 | - /** |
|
611 | - * @return PreviewProviderRegistration[] |
|
612 | - */ |
|
613 | - public function getPreviewProviders(): array { |
|
614 | - return $this->previewProviders; |
|
615 | - } |
|
616 | - |
|
617 | - /** |
|
618 | - * @return ServiceRegistration<ICalendarProvider>[] |
|
619 | - */ |
|
620 | - public function getCalendarProviders(): array { |
|
621 | - return $this->calendarProviders; |
|
622 | - } |
|
623 | - |
|
624 | - /** |
|
625 | - * @return ServiceRegistration<ILinkAction>[] |
|
626 | - */ |
|
627 | - public function getProfileLinkActions(): array { |
|
628 | - return $this->profileLinkActions; |
|
629 | - } |
|
630 | - |
|
631 | - /** |
|
632 | - * @return ServiceRegistration|null |
|
633 | - * @psalm-return ServiceRegistration<ITalkBackend>|null |
|
634 | - */ |
|
635 | - public function getTalkBackendRegistration(): ?ServiceRegistration { |
|
636 | - return $this->talkBackendRegistration; |
|
637 | - } |
|
76 | + /** @var ServiceAliasRegistration[] */ |
|
77 | + private $aliases = []; |
|
78 | + |
|
79 | + /** @var ParameterRegistration[] */ |
|
80 | + private $parameters = []; |
|
81 | + |
|
82 | + /** @var EventListenerRegistration[] */ |
|
83 | + private $eventListeners = []; |
|
84 | + |
|
85 | + /** @var ServiceRegistration<Middleware>[] */ |
|
86 | + private $middlewares = []; |
|
87 | + |
|
88 | + /** @var ServiceRegistration<IProvider>[] */ |
|
89 | + private $searchProviders = []; |
|
90 | + |
|
91 | + /** @var ServiceRegistration<IAlternativeLogin>[] */ |
|
92 | + private $alternativeLogins = []; |
|
93 | + |
|
94 | + /** @var ServiceRegistration<InitialStateProvider>[] */ |
|
95 | + private $initialStates = []; |
|
96 | + |
|
97 | + /** @var ServiceRegistration<IHandler>[] */ |
|
98 | + private $wellKnownHandlers = []; |
|
99 | + |
|
100 | + /** @var ServiceRegistration<ICustomTemplateProvider>[] */ |
|
101 | + private $templateProviders = []; |
|
102 | + |
|
103 | + /** @var ServiceRegistration<INotifier>[] */ |
|
104 | + private $notifierServices = []; |
|
105 | + |
|
106 | + /** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */ |
|
107 | + private $twoFactorProviders = []; |
|
108 | + |
|
109 | + /** @var ServiceRegistration<ICalendarProvider>[] */ |
|
110 | + private $calendarProviders = []; |
|
111 | + |
|
112 | + /** @var LoggerInterface */ |
|
113 | + private $logger; |
|
114 | + |
|
115 | + /** @var PreviewProviderRegistration[] */ |
|
116 | + private $previewProviders = []; |
|
117 | + |
|
118 | + public function __construct(LoggerInterface $logger) { |
|
119 | + $this->logger = $logger; |
|
120 | + } |
|
121 | + |
|
122 | + public function for(string $appId): IRegistrationContext { |
|
123 | + return new class($appId, $this) implements IRegistrationContext { |
|
124 | + /** @var string */ |
|
125 | + private $appId; |
|
126 | + |
|
127 | + /** @var RegistrationContext */ |
|
128 | + private $context; |
|
129 | + |
|
130 | + public function __construct(string $appId, RegistrationContext $context) { |
|
131 | + $this->appId = $appId; |
|
132 | + $this->context = $context; |
|
133 | + } |
|
134 | + |
|
135 | + public function registerCapability(string $capability): void { |
|
136 | + $this->context->registerCapability( |
|
137 | + $this->appId, |
|
138 | + $capability |
|
139 | + ); |
|
140 | + } |
|
141 | + |
|
142 | + public function registerCrashReporter(string $reporterClass): void { |
|
143 | + $this->context->registerCrashReporter( |
|
144 | + $this->appId, |
|
145 | + $reporterClass |
|
146 | + ); |
|
147 | + } |
|
148 | + |
|
149 | + public function registerDashboardWidget(string $widgetClass): void { |
|
150 | + $this->context->registerDashboardPanel( |
|
151 | + $this->appId, |
|
152 | + $widgetClass |
|
153 | + ); |
|
154 | + } |
|
155 | + |
|
156 | + public function registerService(string $name, callable $factory, bool $shared = true): void { |
|
157 | + $this->context->registerService( |
|
158 | + $this->appId, |
|
159 | + $name, |
|
160 | + $factory, |
|
161 | + $shared |
|
162 | + ); |
|
163 | + } |
|
164 | + |
|
165 | + public function registerServiceAlias(string $alias, string $target): void { |
|
166 | + $this->context->registerServiceAlias( |
|
167 | + $this->appId, |
|
168 | + $alias, |
|
169 | + $target |
|
170 | + ); |
|
171 | + } |
|
172 | + |
|
173 | + public function registerParameter(string $name, $value): void { |
|
174 | + $this->context->registerParameter( |
|
175 | + $this->appId, |
|
176 | + $name, |
|
177 | + $value |
|
178 | + ); |
|
179 | + } |
|
180 | + |
|
181 | + public function registerEventListener(string $event, string $listener, int $priority = 0): void { |
|
182 | + $this->context->registerEventListener( |
|
183 | + $this->appId, |
|
184 | + $event, |
|
185 | + $listener, |
|
186 | + $priority |
|
187 | + ); |
|
188 | + } |
|
189 | + |
|
190 | + public function registerMiddleware(string $class): void { |
|
191 | + $this->context->registerMiddleware( |
|
192 | + $this->appId, |
|
193 | + $class |
|
194 | + ); |
|
195 | + } |
|
196 | + |
|
197 | + public function registerSearchProvider(string $class): void { |
|
198 | + $this->context->registerSearchProvider( |
|
199 | + $this->appId, |
|
200 | + $class |
|
201 | + ); |
|
202 | + } |
|
203 | + |
|
204 | + public function registerAlternativeLogin(string $class): void { |
|
205 | + $this->context->registerAlternativeLogin( |
|
206 | + $this->appId, |
|
207 | + $class |
|
208 | + ); |
|
209 | + } |
|
210 | + |
|
211 | + public function registerInitialStateProvider(string $class): void { |
|
212 | + $this->context->registerInitialState( |
|
213 | + $this->appId, |
|
214 | + $class |
|
215 | + ); |
|
216 | + } |
|
217 | + |
|
218 | + public function registerWellKnownHandler(string $class): void { |
|
219 | + $this->context->registerWellKnown( |
|
220 | + $this->appId, |
|
221 | + $class |
|
222 | + ); |
|
223 | + } |
|
224 | + |
|
225 | + public function registerTemplateProvider(string $providerClass): void { |
|
226 | + $this->context->registerTemplateProvider( |
|
227 | + $this->appId, |
|
228 | + $providerClass |
|
229 | + ); |
|
230 | + } |
|
231 | + |
|
232 | + public function registerNotifierService(string $notifierClass): void { |
|
233 | + $this->context->registerNotifierService( |
|
234 | + $this->appId, |
|
235 | + $notifierClass |
|
236 | + ); |
|
237 | + } |
|
238 | + |
|
239 | + public function registerTwoFactorProvider(string $twoFactorProviderClass): void { |
|
240 | + $this->context->registerTwoFactorProvider( |
|
241 | + $this->appId, |
|
242 | + $twoFactorProviderClass |
|
243 | + ); |
|
244 | + } |
|
245 | + |
|
246 | + public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void { |
|
247 | + $this->context->registerPreviewProvider( |
|
248 | + $this->appId, |
|
249 | + $previewProviderClass, |
|
250 | + $mimeTypeRegex |
|
251 | + ); |
|
252 | + } |
|
253 | + |
|
254 | + public function registerCalendarProvider(string $class): void { |
|
255 | + $this->context->registerCalendarProvider( |
|
256 | + $this->appId, |
|
257 | + $class |
|
258 | + ); |
|
259 | + } |
|
260 | + |
|
261 | + public function registerProfileLinkAction(string $actionClass): void { |
|
262 | + $this->context->registerProfileLinkAction( |
|
263 | + $this->appId, |
|
264 | + $actionClass |
|
265 | + ); |
|
266 | + } |
|
267 | + |
|
268 | + public function registerTalkBackend(string $backend): void { |
|
269 | + $this->context->registerTalkBackend( |
|
270 | + $this->appId, |
|
271 | + $backend |
|
272 | + ); |
|
273 | + } |
|
274 | + }; |
|
275 | + } |
|
276 | + |
|
277 | + /** |
|
278 | + * @psalm-param class-string<ICapability> $capability |
|
279 | + */ |
|
280 | + public function registerCapability(string $appId, string $capability): void { |
|
281 | + $this->capabilities[] = new ServiceRegistration($appId, $capability); |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * @psalm-param class-string<IReporter> $capability |
|
286 | + */ |
|
287 | + public function registerCrashReporter(string $appId, string $reporterClass): void { |
|
288 | + $this->crashReporters[] = new ServiceRegistration($appId, $reporterClass); |
|
289 | + } |
|
290 | + |
|
291 | + /** |
|
292 | + * @psalm-param class-string<IWidget> $capability |
|
293 | + */ |
|
294 | + public function registerDashboardPanel(string $appId, string $panelClass): void { |
|
295 | + $this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass); |
|
296 | + } |
|
297 | + |
|
298 | + public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void { |
|
299 | + $this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared); |
|
300 | + } |
|
301 | + |
|
302 | + public function registerServiceAlias(string $appId, string $alias, string $target): void { |
|
303 | + $this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target); |
|
304 | + } |
|
305 | + |
|
306 | + public function registerParameter(string $appId, string $name, $value): void { |
|
307 | + $this->parameters[] = new ParameterRegistration($appId, $name, $value); |
|
308 | + } |
|
309 | + |
|
310 | + public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void { |
|
311 | + $this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority); |
|
312 | + } |
|
313 | + |
|
314 | + /** |
|
315 | + * @psalm-param class-string<Middleware> $class |
|
316 | + */ |
|
317 | + public function registerMiddleware(string $appId, string $class): void { |
|
318 | + $this->middlewares[] = new ServiceRegistration($appId, $class); |
|
319 | + } |
|
320 | + |
|
321 | + public function registerSearchProvider(string $appId, string $class) { |
|
322 | + $this->searchProviders[] = new ServiceRegistration($appId, $class); |
|
323 | + } |
|
324 | + |
|
325 | + public function registerAlternativeLogin(string $appId, string $class): void { |
|
326 | + $this->alternativeLogins[] = new ServiceRegistration($appId, $class); |
|
327 | + } |
|
328 | + |
|
329 | + public function registerInitialState(string $appId, string $class): void { |
|
330 | + $this->initialStates[] = new ServiceRegistration($appId, $class); |
|
331 | + } |
|
332 | + |
|
333 | + public function registerWellKnown(string $appId, string $class): void { |
|
334 | + $this->wellKnownHandlers[] = new ServiceRegistration($appId, $class); |
|
335 | + } |
|
336 | + |
|
337 | + public function registerTemplateProvider(string $appId, string $class): void { |
|
338 | + $this->templateProviders[] = new ServiceRegistration($appId, $class); |
|
339 | + } |
|
340 | + |
|
341 | + public function registerNotifierService(string $appId, string $class): void { |
|
342 | + $this->notifierServices[] = new ServiceRegistration($appId, $class); |
|
343 | + } |
|
344 | + |
|
345 | + public function registerTwoFactorProvider(string $appId, string $class): void { |
|
346 | + $this->twoFactorProviders[] = new ServiceRegistration($appId, $class); |
|
347 | + } |
|
348 | + |
|
349 | + public function registerPreviewProvider(string $appId, string $class, string $mimeTypeRegex): void { |
|
350 | + $this->previewProviders[] = new PreviewProviderRegistration($appId, $class, $mimeTypeRegex); |
|
351 | + } |
|
352 | + |
|
353 | + public function registerCalendarProvider(string $appId, string $class): void { |
|
354 | + $this->calendarProviders[] = new ServiceRegistration($appId, $class); |
|
355 | + } |
|
356 | + |
|
357 | + /** |
|
358 | + * @psalm-param class-string<ILinkAction> $actionClass |
|
359 | + */ |
|
360 | + public function registerProfileLinkAction(string $appId, string $actionClass): void { |
|
361 | + $this->profileLinkActions[] = new ServiceRegistration($appId, $actionClass); |
|
362 | + } |
|
363 | + |
|
364 | + /** |
|
365 | + * @psalm-param class-string<ITalkBackend> $backend |
|
366 | + */ |
|
367 | + public function registerTalkBackend(string $appId, string $backend) { |
|
368 | + // Some safeguards for invalid registrations |
|
369 | + if ($appId !== 'spreed') { |
|
370 | + throw new RuntimeException("Only the Talk app is allowed to register a Talk backend"); |
|
371 | + } |
|
372 | + if ($this->talkBackendRegistration !== null) { |
|
373 | + throw new RuntimeException("There can only be one Talk backend"); |
|
374 | + } |
|
375 | + |
|
376 | + $this->talkBackendRegistration = new ServiceRegistration($appId, $backend); |
|
377 | + } |
|
378 | + |
|
379 | + /** |
|
380 | + * @param App[] $apps |
|
381 | + */ |
|
382 | + public function delegateCapabilityRegistrations(array $apps): void { |
|
383 | + while (($registration = array_shift($this->capabilities)) !== null) { |
|
384 | + $appId = $registration->getAppId(); |
|
385 | + if (!isset($apps[$appId])) { |
|
386 | + // If we land here something really isn't right. But at least we caught the |
|
387 | + // notice that is otherwise emitted for the undefined index |
|
388 | + $this->logger->error("App $appId not loaded for the capability registration"); |
|
389 | + |
|
390 | + continue; |
|
391 | + } |
|
392 | + |
|
393 | + try { |
|
394 | + $apps[$appId] |
|
395 | + ->getContainer() |
|
396 | + ->registerCapability($registration->getService()); |
|
397 | + } catch (Throwable $e) { |
|
398 | + $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
399 | + 'exception' => $e, |
|
400 | + ]); |
|
401 | + } |
|
402 | + } |
|
403 | + } |
|
404 | + |
|
405 | + /** |
|
406 | + * @param App[] $apps |
|
407 | + */ |
|
408 | + public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void { |
|
409 | + while (($registration = array_shift($this->crashReporters)) !== null) { |
|
410 | + try { |
|
411 | + $registry->registerLazy($registration->getService()); |
|
412 | + } catch (Throwable $e) { |
|
413 | + $appId = $registration->getAppId(); |
|
414 | + $this->logger->error("Error during crash reporter registration of $appId: " . $e->getMessage(), [ |
|
415 | + 'exception' => $e, |
|
416 | + ]); |
|
417 | + } |
|
418 | + } |
|
419 | + } |
|
420 | + |
|
421 | + /** |
|
422 | + * @param App[] $apps |
|
423 | + */ |
|
424 | + public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void { |
|
425 | + while (($panel = array_shift($this->dashboardPanels)) !== null) { |
|
426 | + try { |
|
427 | + $dashboardManager->lazyRegisterWidget($panel->getService()); |
|
428 | + } catch (Throwable $e) { |
|
429 | + $appId = $panel->getAppId(); |
|
430 | + $this->logger->error("Error during dashboard registration of $appId: " . $e->getMessage(), [ |
|
431 | + 'exception' => $e, |
|
432 | + ]); |
|
433 | + } |
|
434 | + } |
|
435 | + } |
|
436 | + |
|
437 | + public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void { |
|
438 | + while (($registration = array_shift($this->eventListeners)) !== null) { |
|
439 | + try { |
|
440 | + $eventDispatcher->addServiceListener( |
|
441 | + $registration->getEvent(), |
|
442 | + $registration->getService(), |
|
443 | + $registration->getPriority() |
|
444 | + ); |
|
445 | + } catch (Throwable $e) { |
|
446 | + $appId = $registration->getAppId(); |
|
447 | + $this->logger->error("Error during event listener registration of $appId: " . $e->getMessage(), [ |
|
448 | + 'exception' => $e, |
|
449 | + ]); |
|
450 | + } |
|
451 | + } |
|
452 | + } |
|
453 | + |
|
454 | + /** |
|
455 | + * @param App[] $apps |
|
456 | + */ |
|
457 | + public function delegateContainerRegistrations(array $apps): void { |
|
458 | + while (($registration = array_shift($this->services)) !== null) { |
|
459 | + $appId = $registration->getAppId(); |
|
460 | + if (!isset($apps[$appId])) { |
|
461 | + // If we land here something really isn't right. But at least we caught the |
|
462 | + // notice that is otherwise emitted for the undefined index |
|
463 | + $this->logger->error("App $appId not loaded for the container service registration"); |
|
464 | + |
|
465 | + continue; |
|
466 | + } |
|
467 | + |
|
468 | + try { |
|
469 | + /** |
|
470 | + * Register the service and convert the callable into a \Closure if necessary |
|
471 | + */ |
|
472 | + $apps[$appId] |
|
473 | + ->getContainer() |
|
474 | + ->registerService( |
|
475 | + $registration->getName(), |
|
476 | + Closure::fromCallable($registration->getFactory()), |
|
477 | + $registration->isShared() |
|
478 | + ); |
|
479 | + } catch (Throwable $e) { |
|
480 | + $this->logger->error("Error during service registration of $appId: " . $e->getMessage(), [ |
|
481 | + 'exception' => $e, |
|
482 | + ]); |
|
483 | + } |
|
484 | + } |
|
485 | + |
|
486 | + while (($registration = array_shift($this->aliases)) !== null) { |
|
487 | + $appId = $registration->getAppId(); |
|
488 | + if (!isset($apps[$appId])) { |
|
489 | + // If we land here something really isn't right. But at least we caught the |
|
490 | + // notice that is otherwise emitted for the undefined index |
|
491 | + $this->logger->error("App $appId not loaded for the container alias registration"); |
|
492 | + |
|
493 | + continue; |
|
494 | + } |
|
495 | + |
|
496 | + try { |
|
497 | + $apps[$appId] |
|
498 | + ->getContainer() |
|
499 | + ->registerAlias( |
|
500 | + $registration->getAlias(), |
|
501 | + $registration->getTarget() |
|
502 | + ); |
|
503 | + } catch (Throwable $e) { |
|
504 | + $this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [ |
|
505 | + 'exception' => $e, |
|
506 | + ]); |
|
507 | + } |
|
508 | + } |
|
509 | + |
|
510 | + while (($registration = array_shift($this->parameters)) !== null) { |
|
511 | + $appId = $registration->getAppId(); |
|
512 | + if (!isset($apps[$appId])) { |
|
513 | + // If we land here something really isn't right. But at least we caught the |
|
514 | + // notice that is otherwise emitted for the undefined index |
|
515 | + $this->logger->error("App $appId not loaded for the container parameter registration"); |
|
516 | + |
|
517 | + continue; |
|
518 | + } |
|
519 | + |
|
520 | + try { |
|
521 | + $apps[$appId] |
|
522 | + ->getContainer() |
|
523 | + ->registerParameter( |
|
524 | + $registration->getName(), |
|
525 | + $registration->getValue() |
|
526 | + ); |
|
527 | + } catch (Throwable $e) { |
|
528 | + $this->logger->error("Error during service parameter registration of $appId: " . $e->getMessage(), [ |
|
529 | + 'exception' => $e, |
|
530 | + ]); |
|
531 | + } |
|
532 | + } |
|
533 | + } |
|
534 | + |
|
535 | + /** |
|
536 | + * @param App[] $apps |
|
537 | + */ |
|
538 | + public function delegateMiddlewareRegistrations(array $apps): void { |
|
539 | + while (($middleware = array_shift($this->middlewares)) !== null) { |
|
540 | + $appId = $middleware->getAppId(); |
|
541 | + if (!isset($apps[$appId])) { |
|
542 | + // If we land here something really isn't right. But at least we caught the |
|
543 | + // notice that is otherwise emitted for the undefined index |
|
544 | + $this->logger->error("App $appId not loaded for the container middleware registration"); |
|
545 | + |
|
546 | + continue; |
|
547 | + } |
|
548 | + |
|
549 | + try { |
|
550 | + $apps[$appId] |
|
551 | + ->getContainer() |
|
552 | + ->registerMiddleWare($middleware->getService()); |
|
553 | + } catch (Throwable $e) { |
|
554 | + $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [ |
|
555 | + 'exception' => $e, |
|
556 | + ]); |
|
557 | + } |
|
558 | + } |
|
559 | + } |
|
560 | + |
|
561 | + /** |
|
562 | + * @return ServiceRegistration<IProvider>[] |
|
563 | + */ |
|
564 | + public function getSearchProviders(): array { |
|
565 | + return $this->searchProviders; |
|
566 | + } |
|
567 | + |
|
568 | + /** |
|
569 | + * @return ServiceRegistration<IAlternativeLogin>[] |
|
570 | + */ |
|
571 | + public function getAlternativeLogins(): array { |
|
572 | + return $this->alternativeLogins; |
|
573 | + } |
|
574 | + |
|
575 | + /** |
|
576 | + * @return ServiceRegistration<InitialStateProvider>[] |
|
577 | + */ |
|
578 | + public function getInitialStates(): array { |
|
579 | + return $this->initialStates; |
|
580 | + } |
|
581 | + |
|
582 | + /** |
|
583 | + * @return ServiceRegistration<IHandler>[] |
|
584 | + */ |
|
585 | + public function getWellKnownHandlers(): array { |
|
586 | + return $this->wellKnownHandlers; |
|
587 | + } |
|
588 | + |
|
589 | + /** |
|
590 | + * @return ServiceRegistration<ICustomTemplateProvider>[] |
|
591 | + */ |
|
592 | + public function getTemplateProviders(): array { |
|
593 | + return $this->templateProviders; |
|
594 | + } |
|
595 | + |
|
596 | + /** |
|
597 | + * @return ServiceRegistration<INotifier>[] |
|
598 | + */ |
|
599 | + public function getNotifierServices(): array { |
|
600 | + return $this->notifierServices; |
|
601 | + } |
|
602 | + |
|
603 | + /** |
|
604 | + * @return ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] |
|
605 | + */ |
|
606 | + public function getTwoFactorProviders(): array { |
|
607 | + return $this->twoFactorProviders; |
|
608 | + } |
|
609 | + |
|
610 | + /** |
|
611 | + * @return PreviewProviderRegistration[] |
|
612 | + */ |
|
613 | + public function getPreviewProviders(): array { |
|
614 | + return $this->previewProviders; |
|
615 | + } |
|
616 | + |
|
617 | + /** |
|
618 | + * @return ServiceRegistration<ICalendarProvider>[] |
|
619 | + */ |
|
620 | + public function getCalendarProviders(): array { |
|
621 | + return $this->calendarProviders; |
|
622 | + } |
|
623 | + |
|
624 | + /** |
|
625 | + * @return ServiceRegistration<ILinkAction>[] |
|
626 | + */ |
|
627 | + public function getProfileLinkActions(): array { |
|
628 | + return $this->profileLinkActions; |
|
629 | + } |
|
630 | + |
|
631 | + /** |
|
632 | + * @return ServiceRegistration|null |
|
633 | + * @psalm-return ServiceRegistration<ITalkBackend>|null |
|
634 | + */ |
|
635 | + public function getTalkBackendRegistration(): ?ServiceRegistration { |
|
636 | + return $this->talkBackendRegistration; |
|
637 | + } |
|
638 | 638 | } |
@@ -37,38 +37,38 @@ |
||
37 | 37 | */ |
38 | 38 | interface IBroker { |
39 | 39 | |
40 | - /** |
|
41 | - * Check if the Talk backend is available |
|
42 | - * |
|
43 | - * @return bool |
|
44 | - * @since 24.0.0 |
|
45 | - */ |
|
46 | - public function hasBackend(): bool; |
|
40 | + /** |
|
41 | + * Check if the Talk backend is available |
|
42 | + * |
|
43 | + * @return bool |
|
44 | + * @since 24.0.0 |
|
45 | + */ |
|
46 | + public function hasBackend(): bool; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Create a new instance of the objects object for specifics of a new conversation |
|
50 | - * |
|
51 | - * @return IConversationOptions |
|
52 | - * @throws NoBackendException when Talk is not available |
|
53 | - * @since 24.0.0 |
|
54 | - */ |
|
55 | - public function newConversationOptions(): IConversationOptions; |
|
48 | + /** |
|
49 | + * Create a new instance of the objects object for specifics of a new conversation |
|
50 | + * |
|
51 | + * @return IConversationOptions |
|
52 | + * @throws NoBackendException when Talk is not available |
|
53 | + * @since 24.0.0 |
|
54 | + */ |
|
55 | + public function newConversationOptions(): IConversationOptions; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Create a new conversation |
|
59 | - * |
|
60 | - * The conversation is private by default. Use the options parameter to make |
|
61 | - * it public. |
|
62 | - * |
|
63 | - * @param string $name |
|
64 | - * @param IUser[] $moderators |
|
65 | - * @param IConversationOptions|null $options optional configuration for the conversation |
|
66 | - * |
|
67 | - * @return IConversation |
|
68 | - * @throws NoBackendException when Talk is not available |
|
69 | - * @since 24.0.0 |
|
70 | - */ |
|
71 | - public function createConversation(string $name, |
|
72 | - array $moderators, |
|
73 | - IConversationOptions $options = null): IConversation; |
|
57 | + /** |
|
58 | + * Create a new conversation |
|
59 | + * |
|
60 | + * The conversation is private by default. Use the options parameter to make |
|
61 | + * it public. |
|
62 | + * |
|
63 | + * @param string $name |
|
64 | + * @param IUser[] $moderators |
|
65 | + * @param IConversationOptions|null $options optional configuration for the conversation |
|
66 | + * |
|
67 | + * @return IConversation |
|
68 | + * @throws NoBackendException when Talk is not available |
|
69 | + * @since 24.0.0 |
|
70 | + */ |
|
71 | + public function createConversation(string $name, |
|
72 | + array $moderators, |
|
73 | + IConversationOptions $options = null): IConversation; |
|
74 | 74 | } |
@@ -30,21 +30,21 @@ |
||
30 | 30 | */ |
31 | 31 | interface IConversationOptions { |
32 | 32 | |
33 | - /** |
|
34 | - * Will the conversation be public? |
|
35 | - * |
|
36 | - * @return bool |
|
37 | - * @since 24.0.0 |
|
38 | - */ |
|
39 | - public function isPublic(): bool; |
|
33 | + /** |
|
34 | + * Will the conversation be public? |
|
35 | + * |
|
36 | + * @return bool |
|
37 | + * @since 24.0.0 |
|
38 | + */ |
|
39 | + public function isPublic(): bool; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Make the new conversation public |
|
43 | - * |
|
44 | - * @param bool $isPublic |
|
45 | - * |
|
46 | - * @return $this |
|
47 | - * @since 24.0.0 |
|
48 | - */ |
|
49 | - public function setPublic(bool $isPublic = true): self; |
|
41 | + /** |
|
42 | + * Make the new conversation public |
|
43 | + * |
|
44 | + * @param bool $isPublic |
|
45 | + * |
|
46 | + * @return $this |
|
47 | + * @since 24.0.0 |
|
48 | + */ |
|
49 | + public function setPublic(bool $isPublic = true): self; |
|
50 | 50 | } |
@@ -38,15 +38,15 @@ |
||
38 | 38 | */ |
39 | 39 | interface ITalkBackend { |
40 | 40 | |
41 | - /** |
|
42 | - * @param string $name |
|
43 | - * @param IUser[] $moderators |
|
44 | - * @param IConversationOptions $options configuration for the conversation |
|
45 | - * |
|
46 | - * @return IConversation |
|
47 | - * @since 24.0.0 |
|
48 | - */ |
|
49 | - public function createConversation(string $name, |
|
50 | - array $moderators, |
|
51 | - IConversationOptions $options): IConversation; |
|
41 | + /** |
|
42 | + * @param string $name |
|
43 | + * @param IUser[] $moderators |
|
44 | + * @param IConversationOptions $options configuration for the conversation |
|
45 | + * |
|
46 | + * @return IConversation |
|
47 | + * @since 24.0.0 |
|
48 | + */ |
|
49 | + public function createConversation(string $name, |
|
50 | + array $moderators, |
|
51 | + IConversationOptions $options): IConversation; |
|
52 | 52 | } |
@@ -30,11 +30,11 @@ |
||
30 | 30 | */ |
31 | 31 | interface IConversation { |
32 | 32 | |
33 | - /** |
|
34 | - * Get the absolute URL to this conversation |
|
35 | - * |
|
36 | - * @return string |
|
37 | - * @since 24.0.0 |
|
38 | - */ |
|
39 | - public function getAbsoluteUrl(): string; |
|
33 | + /** |
|
34 | + * Get the absolute URL to this conversation |
|
35 | + * |
|
36 | + * @return string |
|
37 | + * @since 24.0.0 |
|
38 | + */ |
|
39 | + public function getAbsoluteUrl(): string; |
|
40 | 40 | } |
@@ -47,232 +47,232 @@ |
||
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 | } |