Passed
Push — master ( f4c719...cd7a21 )
by Christoph
18:01 queued 11s
created

RegistrationContext::registerInitialState()

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 2
dl 0
loc 2
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright 2020 Christoph Wurst <[email protected]>
7
 *
8
 * @author Christoph Wurst <[email protected]>
9
 * @author Joas Schilling <[email protected]>
10
 * @author Julius Härtl <[email protected]>
11
 * @author Roeland Jago Douma <[email protected]>
12
 *
13
 * @license GNU AGPL version 3 or any later version
14
 *
15
 * This program is free software: you can redistribute it and/or modify
16
 * it under the terms of the GNU Affero General Public License as
17
 * published by the Free Software Foundation, either version 3 of the
18
 * License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
 * GNU Affero General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU Affero General Public License
26
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
 *
28
 */
29
30
namespace OC\AppFramework\Bootstrap;
31
32
use Closure;
33
use OCP\Calendar\Resource\IBackend as IResourceBackend;
34
use OCP\Calendar\Room\IBackend as IRoomBackend;
35
use OCP\Talk\ITalkBackend;
36
use RuntimeException;
37
use function array_shift;
38
use OC\Support\CrashReport\Registry;
39
use OCP\AppFramework\App;
40
use OCP\AppFramework\Bootstrap\IRegistrationContext;
41
use OCP\AppFramework\Middleware;
42
use OCP\AppFramework\Services\InitialStateProvider;
43
use OCP\Authentication\IAlternativeLogin;
44
use OCP\Calendar\ICalendarProvider;
45
use OCP\Capabilities\ICapability;
46
use OCP\Dashboard\IManager;
47
use OCP\Dashboard\IWidget;
48
use OCP\EventDispatcher\IEventDispatcher;
49
use OCP\Files\Template\ICustomTemplateProvider;
50
use OCP\Http\WellKnown\IHandler;
51
use OCP\Notification\INotifier;
52
use OCP\Profile\ILinkAction;
53
use OCP\Search\IProvider;
54
use OCP\Support\CrashReport\IReporter;
55
use Psr\Log\LoggerInterface;
56
use Throwable;
57
58
class RegistrationContext {
59
60
	/** @var ServiceRegistration<ICapability>[] */
61
	private $capabilities = [];
62
63
	/** @var ServiceRegistration<IReporter>[] */
64
	private $crashReporters = [];
65
66
	/** @var ServiceRegistration<IWidget>[] */
67
	private $dashboardPanels = [];
68
69
	/** @var ServiceRegistration<ILinkAction>[] */
70
	private $profileLinkActions = [];
71
72
	/** @var null|ServiceRegistration<ITalkBackend> */
73
	private $talkBackendRegistration = null;
74
75
	/** @var ServiceRegistration<IResourceBackend>[] */
76
	private $calendarResourceBackendRegistrations = [];
77
78
	/** @var ServiceRegistration<IRoomBackend>[] */
79
	private $calendarRoomBackendRegistrations = [];
80
81
	/** @var ServiceFactoryRegistration[] */
82
	private $services = [];
83
84
	/** @var ServiceAliasRegistration[] */
85
	private $aliases = [];
86
87
	/** @var ParameterRegistration[] */
88
	private $parameters = [];
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) {
0 ignored issues
show
Bug introduced by
$this->capabilities of type OC\AppFramework\Bootstrap\ServiceRegistration is incompatible with the type array expected by parameter $array of array_shift(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

419
		while (($registration = array_shift(/** @scrutinizer ignore-type */ $this->capabilities)) !== null) {
Loading history...
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 {
0 ignored issues
show
Unused Code introduced by
The parameter $apps is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

444
	public function delegateCrashReporterRegistrations(/** @scrutinizer ignore-unused */ array $apps, Registry $registry): void {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
445
		while (($registration = array_shift($this->crashReporters)) !== null) {
0 ignored issues
show
Bug introduced by
$this->crashReporters of type OC\AppFramework\Bootstrap\ServiceRegistration is incompatible with the type array expected by parameter $array of array_shift(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

445
		while (($registration = array_shift(/** @scrutinizer ignore-type */ $this->crashReporters)) !== null) {
Loading history...
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 {
0 ignored issues
show
Unused Code introduced by
The parameter $apps is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

460
	public function delegateDashboardPanelRegistrations(/** @scrutinizer ignore-unused */ array $apps, IManager $dashboardManager): void {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
461
		while (($panel = array_shift($this->dashboardPanels)) !== null) {
0 ignored issues
show
Bug introduced by
$this->dashboardPanels of type OC\AppFramework\Bootstrap\ServiceRegistration is incompatible with the type array expected by parameter $array of array_shift(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

461
		while (($panel = array_shift(/** @scrutinizer ignore-type */ $this->dashboardPanels)) !== null) {
Loading history...
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) {
0 ignored issues
show
Bug introduced by
$this->middlewares of type OC\AppFramework\Bootstrap\ServiceRegistration is incompatible with the type array expected by parameter $array of array_shift(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

575
		while (($middleware = array_shift(/** @scrutinizer ignore-type */ $this->middlewares)) !== null) {
Loading history...
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;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->searchProviders returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
602
	}
603
604
	/**
605
	 * @return ServiceRegistration<IAlternativeLogin>[]
606
	 */
607
	public function getAlternativeLogins(): array {
608
		return $this->alternativeLogins;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->alternativeLogins returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
609
	}
610
611
	/**
612
	 * @return ServiceRegistration<InitialStateProvider>[]
613
	 */
614
	public function getInitialStates(): array {
615
		return $this->initialStates;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->initialStates returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
616
	}
617
618
	/**
619
	 * @return ServiceRegistration<IHandler>[]
620
	 */
621
	public function getWellKnownHandlers(): array {
622
		return $this->wellKnownHandlers;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->wellKnownHandlers returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
623
	}
624
625
	/**
626
	 * @return ServiceRegistration<ICustomTemplateProvider>[]
627
	 */
628
	public function getTemplateProviders(): array {
629
		return $this->templateProviders;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->templateProviders returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
630
	}
631
632
	/**
633
	 * @return ServiceRegistration<INotifier>[]
634
	 */
635
	public function getNotifierServices(): array {
636
		return $this->notifierServices;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->notifierServices returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
637
	}
638
639
	/**
640
	 * @return ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[]
641
	 */
642
	public function getTwoFactorProviders(): array {
643
		return $this->twoFactorProviders;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->twoFactorProviders returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
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;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->calendarProviders returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
658
	}
659
660
	/**
661
	 * @return ServiceRegistration<ILinkAction>[]
662
	 */
663
	public function getProfileLinkActions(): array {
664
		return $this->profileLinkActions;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->profileLinkActions returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
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;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->calendarRe...rceBackendRegistrations returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
681
	}
682
683
	/**
684
	 * @return ServiceRegistration[]
685
	 * @psalm-return ServiceRegistration<IRoomBackend>[]
686
	 */
687
	public function getCalendarRoomBackendRegistrations(): array {
688
		return $this->calendarRoomBackendRegistrations;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->calendarRoomBackendRegistrations returns the type OC\AppFramework\Bootstrap\ServiceRegistration which is incompatible with the type-hinted return array.
Loading history...
689
	}
690
}
691