Passed
Push — master ( c8f7a8...ce082d )
by Christoph
13:27 queued 19s
created
lib/private/AppFramework/Bootstrap/RegistrationContext.php 1 patch
Indentation   +409 added lines, -409 removed lines patch added patch discarded remove patch
@@ -50,413 +50,413 @@
 block discarded – undo
50 50
 
51 51
 class RegistrationContext {
52 52
 
53
-	/** @var ServiceRegistration<ICapability>[] */
54
-	private $capabilities = [];
55
-
56
-	/** @var ServiceRegistration<IReporter>[] */
57
-	private $crashReporters = [];
58
-
59
-	/** @var ServiceRegistration<IWidget>[] */
60
-	private $dashboardPanels = [];
61
-
62
-	/** @var ServiceFactoryRegistration[] */
63
-	private $services = [];
64
-
65
-	/** @var ServiceAliasRegistration[] */
66
-	private $aliases = [];
67
-
68
-	/** @var ParameterRegistration[] */
69
-	private $parameters = [];
70
-
71
-	/** @var EventListenerRegistration[] */
72
-	private $eventListeners = [];
73
-
74
-	/** @var ServiceRegistration<Middleware>[] */
75
-	private $middlewares = [];
76
-
77
-	/** @var ServiceRegistration<IProvider>[] */
78
-	private $searchProviders = [];
79
-
80
-	/** @var ServiceRegistration<IAlternativeLogin>[] */
81
-	private $alternativeLogins = [];
82
-
83
-	/** @var array[] */
84
-	private $initialStates = [];
85
-
86
-	/** @var ServiceRegistration<IHandler>[] */
87
-	private $wellKnownHandlers = [];
88
-
89
-	/** @var ServiceRegistration<ICustomTemplateProvider>[] */
90
-	private $templateProviders = [];
91
-
92
-	/** @var ILogger */
93
-	private $logger;
94
-
95
-	public function __construct(ILogger $logger) {
96
-		$this->logger = $logger;
97
-	}
98
-
99
-	public function for(string $appId): IRegistrationContext {
100
-		return new class($appId, $this) implements IRegistrationContext {
101
-			/** @var string */
102
-			private $appId;
103
-
104
-			/** @var RegistrationContext */
105
-			private $context;
106
-
107
-			public function __construct(string $appId, RegistrationContext $context) {
108
-				$this->appId = $appId;
109
-				$this->context = $context;
110
-			}
111
-
112
-			public function registerCapability(string $capability): void {
113
-				$this->context->registerCapability(
114
-					$this->appId,
115
-					$capability
116
-				);
117
-			}
118
-
119
-			public function registerCrashReporter(string $reporterClass): void {
120
-				$this->context->registerCrashReporter(
121
-					$this->appId,
122
-					$reporterClass
123
-				);
124
-			}
125
-
126
-			public function registerDashboardWidget(string $widgetClass): void {
127
-				$this->context->registerDashboardPanel(
128
-					$this->appId,
129
-					$widgetClass
130
-				);
131
-			}
132
-
133
-			public function registerService(string $name, callable $factory, bool $shared = true): void {
134
-				$this->context->registerService(
135
-					$this->appId,
136
-					$name,
137
-					$factory,
138
-					$shared
139
-				);
140
-			}
141
-
142
-			public function registerServiceAlias(string $alias, string $target): void {
143
-				$this->context->registerServiceAlias(
144
-					$this->appId,
145
-					$alias,
146
-					$target
147
-				);
148
-			}
149
-
150
-			public function registerParameter(string $name, $value): void {
151
-				$this->context->registerParameter(
152
-					$this->appId,
153
-					$name,
154
-					$value
155
-				);
156
-			}
157
-
158
-			public function registerEventListener(string $event, string $listener, int $priority = 0): void {
159
-				$this->context->registerEventListener(
160
-					$this->appId,
161
-					$event,
162
-					$listener,
163
-					$priority
164
-				);
165
-			}
166
-
167
-			public function registerMiddleware(string $class): void {
168
-				$this->context->registerMiddleware(
169
-					$this->appId,
170
-					$class
171
-				);
172
-			}
173
-
174
-			public function registerSearchProvider(string $class): void {
175
-				$this->context->registerSearchProvider(
176
-					$this->appId,
177
-					$class
178
-				);
179
-			}
180
-
181
-			public function registerAlternativeLogin(string $class): void {
182
-				$this->context->registerAlternativeLogin(
183
-					$this->appId,
184
-					$class
185
-				);
186
-			}
187
-
188
-			public function registerInitialStateProvider(string $class): void {
189
-				$this->context->registerInitialState(
190
-					$this->appId,
191
-					$class
192
-				);
193
-			}
194
-
195
-			public function registerWellKnownHandler(string $class): void {
196
-				$this->context->registerWellKnown(
197
-					$this->appId,
198
-					$class
199
-				);
200
-			}
201
-
202
-			public function registerTemplateProvider(string $providerClass): void {
203
-				$this->context->registerTemplateProvider(
204
-					$this->appId,
205
-					$providerClass
206
-				);
207
-			}
208
-		};
209
-	}
210
-
211
-	/**
212
-	 * @psalm-param class-string<ICapability> $capability
213
-	 */
214
-	public function registerCapability(string $appId, string $capability): void {
215
-		$this->capabilities[] = new ServiceRegistration($appId, $capability);
216
-	}
217
-
218
-	/**
219
-	 * @psalm-param class-string<IReporter> $capability
220
-	 */
221
-	public function registerCrashReporter(string $appId, string $reporterClass): void {
222
-		$this->crashReporters[] = new ServiceRegistration($appId, $reporterClass);
223
-	}
224
-
225
-	/**
226
-	 * @psalm-param class-string<IWidget> $capability
227
-	 */
228
-	public function registerDashboardPanel(string $appId, string $panelClass): void {
229
-		$this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass);
230
-	}
231
-
232
-	public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void {
233
-		$this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared);
234
-	}
235
-
236
-	public function registerServiceAlias(string $appId, string $alias, string $target): void {
237
-		$this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target);
238
-	}
239
-
240
-	public function registerParameter(string $appId, string $name, $value): void {
241
-		$this->parameters[] = new ParameterRegistration($appId, $name, $value);
242
-	}
243
-
244
-	public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void {
245
-		$this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority);
246
-	}
247
-
248
-	/**
249
-	 * @psalm-param class-string<Middleware> $class
250
-	 */
251
-	public function registerMiddleware(string $appId, string $class): void {
252
-		$this->middlewares[] = new ServiceRegistration($appId, $class);
253
-	}
254
-
255
-	public function registerSearchProvider(string $appId, string $class) {
256
-		$this->searchProviders[] = new ServiceRegistration($appId, $class);
257
-	}
258
-
259
-	public function registerAlternativeLogin(string $appId, string $class): void {
260
-		$this->alternativeLogins[] = new ServiceRegistration($appId, $class);
261
-	}
262
-
263
-	public function registerInitialState(string $appId, string $class): void {
264
-		$this->initialStates[] = [
265
-			'appId' => $appId,
266
-			'class' => $class,
267
-		];
268
-	}
269
-
270
-	public function registerWellKnown(string $appId, string $class): void {
271
-		$this->wellKnownHandlers[] = new ServiceRegistration($appId, $class);
272
-	}
273
-
274
-	public function registerTemplateProvider(string $appId, string $class): void {
275
-		$this->templateProviders[] = new ServiceRegistration($appId, $class);
276
-	}
277
-
278
-	/**
279
-	 * @param App[] $apps
280
-	 */
281
-	public function delegateCapabilityRegistrations(array $apps): void {
282
-		while (($registration = array_shift($this->capabilities)) !== null) {
283
-			try {
284
-				$apps[$registration->getAppId()]
285
-					->getContainer()
286
-					->registerCapability($registration->getService());
287
-			} catch (Throwable $e) {
288
-				$appId = $registration->getAppId();
289
-				$this->logger->logException($e, [
290
-					'message' => "Error during capability registration of $appId: " . $e->getMessage(),
291
-					'level' => ILogger::ERROR,
292
-				]);
293
-			}
294
-		}
295
-	}
296
-
297
-	/**
298
-	 * @param App[] $apps
299
-	 */
300
-	public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void {
301
-		while (($registration = array_shift($this->crashReporters)) !== null) {
302
-			try {
303
-				$registry->registerLazy($registration->getService());
304
-			} catch (Throwable $e) {
305
-				$appId = $registration->getAppId();
306
-				$this->logger->logException($e, [
307
-					'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
308
-					'level' => ILogger::ERROR,
309
-				]);
310
-			}
311
-		}
312
-	}
313
-
314
-	/**
315
-	 * @param App[] $apps
316
-	 */
317
-	public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void {
318
-		while (($panel = array_shift($this->dashboardPanels)) !== null) {
319
-			try {
320
-				$dashboardManager->lazyRegisterWidget($panel->getService());
321
-			} catch (Throwable $e) {
322
-				$appId = $panel->getAppId();
323
-				$this->logger->logException($e, [
324
-					'message' => "Error during dashboard registration of $appId: " . $e->getMessage(),
325
-					'level' => ILogger::ERROR,
326
-				]);
327
-			}
328
-		}
329
-	}
330
-
331
-	public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void {
332
-		while (($registration = array_shift($this->eventListeners)) !== null) {
333
-			try {
334
-				$eventDispatcher->addServiceListener(
335
-					$registration->getEvent(),
336
-					$registration->getService(),
337
-					$registration->getPriority()
338
-				);
339
-			} catch (Throwable $e) {
340
-				$appId = $registration->getAppId();
341
-				$this->logger->logException($e, [
342
-					'message' => "Error during event listener registration of $appId: " . $e->getMessage(),
343
-					'level' => ILogger::ERROR,
344
-				]);
345
-			}
346
-		}
347
-	}
348
-
349
-	/**
350
-	 * @param App[] $apps
351
-	 */
352
-	public function delegateContainerRegistrations(array $apps): void {
353
-		while (($registration = array_shift($this->services)) !== null) {
354
-			try {
355
-				/**
356
-				 * Register the service and convert the callable into a \Closure if necessary
357
-				 */
358
-				$apps[$registration->getAppId()]
359
-					->getContainer()
360
-					->registerService(
361
-						$registration->getName(),
362
-						Closure::fromCallable($registration->getFactory()),
363
-						$registration->isShared()
364
-					);
365
-			} catch (Throwable $e) {
366
-				$appId = $registration->getAppId();
367
-				$this->logger->logException($e, [
368
-					'message' => "Error during service registration of $appId: " . $e->getMessage(),
369
-					'level' => ILogger::ERROR,
370
-				]);
371
-			}
372
-		}
373
-
374
-		while (($registration = array_shift($this->aliases)) !== null) {
375
-			try {
376
-				$apps[$registration->getAppId()]
377
-					->getContainer()
378
-					->registerAlias(
379
-						$registration->getAlias(),
380
-						$registration->getTarget()
381
-					);
382
-			} catch (Throwable $e) {
383
-				$appId = $registration->getAppId();
384
-				$this->logger->logException($e, [
385
-					'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
386
-					'level' => ILogger::ERROR,
387
-				]);
388
-			}
389
-		}
390
-
391
-		while (($registration = array_shift($this->parameters)) !== null) {
392
-			try {
393
-				$apps[$registration->getAppId()]
394
-					->getContainer()
395
-					->registerParameter(
396
-						$registration->getName(),
397
-						$registration->getValue()
398
-					);
399
-			} catch (Throwable $e) {
400
-				$appId = $registration->getAppId();
401
-				$this->logger->logException($e, [
402
-					'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
403
-					'level' => ILogger::ERROR,
404
-				]);
405
-			}
406
-		}
407
-	}
408
-
409
-	/**
410
-	 * @param App[] $apps
411
-	 */
412
-	public function delegateMiddlewareRegistrations(array $apps): void {
413
-		while (($middleware = array_shift($this->middlewares)) !== null) {
414
-			try {
415
-				$apps[$middleware->getAppId()]
416
-					->getContainer()
417
-					->registerMiddleWare($middleware->getService());
418
-			} catch (Throwable $e) {
419
-				$appId = $middleware->getAppId();
420
-				$this->logger->logException($e, [
421
-					'message' => "Error during capability registration of $appId: " . $e->getMessage(),
422
-					'level' => ILogger::ERROR,
423
-				]);
424
-			}
425
-		}
426
-	}
427
-
428
-	/**
429
-	 * @return ServiceRegistration<IProvider>[]
430
-	 */
431
-	public function getSearchProviders(): array {
432
-		return $this->searchProviders;
433
-	}
434
-
435
-	/**
436
-	 * @return ServiceRegistration<IAlternativeLogin>[]
437
-	 */
438
-	public function getAlternativeLogins(): array {
439
-		return $this->alternativeLogins;
440
-	}
441
-
442
-	/**
443
-	 * @return array[]
444
-	 */
445
-	public function getInitialStates(): array {
446
-		return $this->initialStates;
447
-	}
448
-
449
-	/**
450
-	 * @return ServiceRegistration<IHandler>[]
451
-	 */
452
-	public function getWellKnownHandlers(): array {
453
-		return $this->wellKnownHandlers;
454
-	}
455
-
456
-	/**
457
-	 * @return ServiceRegistration<ICustomTemplateProvider>[]
458
-	 */
459
-	public function getTemplateProviders(): array {
460
-		return $this->templateProviders;
461
-	}
53
+    /** @var ServiceRegistration<ICapability>[] */
54
+    private $capabilities = [];
55
+
56
+    /** @var ServiceRegistration<IReporter>[] */
57
+    private $crashReporters = [];
58
+
59
+    /** @var ServiceRegistration<IWidget>[] */
60
+    private $dashboardPanels = [];
61
+
62
+    /** @var ServiceFactoryRegistration[] */
63
+    private $services = [];
64
+
65
+    /** @var ServiceAliasRegistration[] */
66
+    private $aliases = [];
67
+
68
+    /** @var ParameterRegistration[] */
69
+    private $parameters = [];
70
+
71
+    /** @var EventListenerRegistration[] */
72
+    private $eventListeners = [];
73
+
74
+    /** @var ServiceRegistration<Middleware>[] */
75
+    private $middlewares = [];
76
+
77
+    /** @var ServiceRegistration<IProvider>[] */
78
+    private $searchProviders = [];
79
+
80
+    /** @var ServiceRegistration<IAlternativeLogin>[] */
81
+    private $alternativeLogins = [];
82
+
83
+    /** @var array[] */
84
+    private $initialStates = [];
85
+
86
+    /** @var ServiceRegistration<IHandler>[] */
87
+    private $wellKnownHandlers = [];
88
+
89
+    /** @var ServiceRegistration<ICustomTemplateProvider>[] */
90
+    private $templateProviders = [];
91
+
92
+    /** @var ILogger */
93
+    private $logger;
94
+
95
+    public function __construct(ILogger $logger) {
96
+        $this->logger = $logger;
97
+    }
98
+
99
+    public function for(string $appId): IRegistrationContext {
100
+        return new class($appId, $this) implements IRegistrationContext {
101
+            /** @var string */
102
+            private $appId;
103
+
104
+            /** @var RegistrationContext */
105
+            private $context;
106
+
107
+            public function __construct(string $appId, RegistrationContext $context) {
108
+                $this->appId = $appId;
109
+                $this->context = $context;
110
+            }
111
+
112
+            public function registerCapability(string $capability): void {
113
+                $this->context->registerCapability(
114
+                    $this->appId,
115
+                    $capability
116
+                );
117
+            }
118
+
119
+            public function registerCrashReporter(string $reporterClass): void {
120
+                $this->context->registerCrashReporter(
121
+                    $this->appId,
122
+                    $reporterClass
123
+                );
124
+            }
125
+
126
+            public function registerDashboardWidget(string $widgetClass): void {
127
+                $this->context->registerDashboardPanel(
128
+                    $this->appId,
129
+                    $widgetClass
130
+                );
131
+            }
132
+
133
+            public function registerService(string $name, callable $factory, bool $shared = true): void {
134
+                $this->context->registerService(
135
+                    $this->appId,
136
+                    $name,
137
+                    $factory,
138
+                    $shared
139
+                );
140
+            }
141
+
142
+            public function registerServiceAlias(string $alias, string $target): void {
143
+                $this->context->registerServiceAlias(
144
+                    $this->appId,
145
+                    $alias,
146
+                    $target
147
+                );
148
+            }
149
+
150
+            public function registerParameter(string $name, $value): void {
151
+                $this->context->registerParameter(
152
+                    $this->appId,
153
+                    $name,
154
+                    $value
155
+                );
156
+            }
157
+
158
+            public function registerEventListener(string $event, string $listener, int $priority = 0): void {
159
+                $this->context->registerEventListener(
160
+                    $this->appId,
161
+                    $event,
162
+                    $listener,
163
+                    $priority
164
+                );
165
+            }
166
+
167
+            public function registerMiddleware(string $class): void {
168
+                $this->context->registerMiddleware(
169
+                    $this->appId,
170
+                    $class
171
+                );
172
+            }
173
+
174
+            public function registerSearchProvider(string $class): void {
175
+                $this->context->registerSearchProvider(
176
+                    $this->appId,
177
+                    $class
178
+                );
179
+            }
180
+
181
+            public function registerAlternativeLogin(string $class): void {
182
+                $this->context->registerAlternativeLogin(
183
+                    $this->appId,
184
+                    $class
185
+                );
186
+            }
187
+
188
+            public function registerInitialStateProvider(string $class): void {
189
+                $this->context->registerInitialState(
190
+                    $this->appId,
191
+                    $class
192
+                );
193
+            }
194
+
195
+            public function registerWellKnownHandler(string $class): void {
196
+                $this->context->registerWellKnown(
197
+                    $this->appId,
198
+                    $class
199
+                );
200
+            }
201
+
202
+            public function registerTemplateProvider(string $providerClass): void {
203
+                $this->context->registerTemplateProvider(
204
+                    $this->appId,
205
+                    $providerClass
206
+                );
207
+            }
208
+        };
209
+    }
210
+
211
+    /**
212
+     * @psalm-param class-string<ICapability> $capability
213
+     */
214
+    public function registerCapability(string $appId, string $capability): void {
215
+        $this->capabilities[] = new ServiceRegistration($appId, $capability);
216
+    }
217
+
218
+    /**
219
+     * @psalm-param class-string<IReporter> $capability
220
+     */
221
+    public function registerCrashReporter(string $appId, string $reporterClass): void {
222
+        $this->crashReporters[] = new ServiceRegistration($appId, $reporterClass);
223
+    }
224
+
225
+    /**
226
+     * @psalm-param class-string<IWidget> $capability
227
+     */
228
+    public function registerDashboardPanel(string $appId, string $panelClass): void {
229
+        $this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass);
230
+    }
231
+
232
+    public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void {
233
+        $this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared);
234
+    }
235
+
236
+    public function registerServiceAlias(string $appId, string $alias, string $target): void {
237
+        $this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target);
238
+    }
239
+
240
+    public function registerParameter(string $appId, string $name, $value): void {
241
+        $this->parameters[] = new ParameterRegistration($appId, $name, $value);
242
+    }
243
+
244
+    public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void {
245
+        $this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority);
246
+    }
247
+
248
+    /**
249
+     * @psalm-param class-string<Middleware> $class
250
+     */
251
+    public function registerMiddleware(string $appId, string $class): void {
252
+        $this->middlewares[] = new ServiceRegistration($appId, $class);
253
+    }
254
+
255
+    public function registerSearchProvider(string $appId, string $class) {
256
+        $this->searchProviders[] = new ServiceRegistration($appId, $class);
257
+    }
258
+
259
+    public function registerAlternativeLogin(string $appId, string $class): void {
260
+        $this->alternativeLogins[] = new ServiceRegistration($appId, $class);
261
+    }
262
+
263
+    public function registerInitialState(string $appId, string $class): void {
264
+        $this->initialStates[] = [
265
+            'appId' => $appId,
266
+            'class' => $class,
267
+        ];
268
+    }
269
+
270
+    public function registerWellKnown(string $appId, string $class): void {
271
+        $this->wellKnownHandlers[] = new ServiceRegistration($appId, $class);
272
+    }
273
+
274
+    public function registerTemplateProvider(string $appId, string $class): void {
275
+        $this->templateProviders[] = new ServiceRegistration($appId, $class);
276
+    }
277
+
278
+    /**
279
+     * @param App[] $apps
280
+     */
281
+    public function delegateCapabilityRegistrations(array $apps): void {
282
+        while (($registration = array_shift($this->capabilities)) !== null) {
283
+            try {
284
+                $apps[$registration->getAppId()]
285
+                    ->getContainer()
286
+                    ->registerCapability($registration->getService());
287
+            } catch (Throwable $e) {
288
+                $appId = $registration->getAppId();
289
+                $this->logger->logException($e, [
290
+                    'message' => "Error during capability registration of $appId: " . $e->getMessage(),
291
+                    'level' => ILogger::ERROR,
292
+                ]);
293
+            }
294
+        }
295
+    }
296
+
297
+    /**
298
+     * @param App[] $apps
299
+     */
300
+    public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void {
301
+        while (($registration = array_shift($this->crashReporters)) !== null) {
302
+            try {
303
+                $registry->registerLazy($registration->getService());
304
+            } catch (Throwable $e) {
305
+                $appId = $registration->getAppId();
306
+                $this->logger->logException($e, [
307
+                    'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
308
+                    'level' => ILogger::ERROR,
309
+                ]);
310
+            }
311
+        }
312
+    }
313
+
314
+    /**
315
+     * @param App[] $apps
316
+     */
317
+    public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void {
318
+        while (($panel = array_shift($this->dashboardPanels)) !== null) {
319
+            try {
320
+                $dashboardManager->lazyRegisterWidget($panel->getService());
321
+            } catch (Throwable $e) {
322
+                $appId = $panel->getAppId();
323
+                $this->logger->logException($e, [
324
+                    'message' => "Error during dashboard registration of $appId: " . $e->getMessage(),
325
+                    'level' => ILogger::ERROR,
326
+                ]);
327
+            }
328
+        }
329
+    }
330
+
331
+    public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void {
332
+        while (($registration = array_shift($this->eventListeners)) !== null) {
333
+            try {
334
+                $eventDispatcher->addServiceListener(
335
+                    $registration->getEvent(),
336
+                    $registration->getService(),
337
+                    $registration->getPriority()
338
+                );
339
+            } catch (Throwable $e) {
340
+                $appId = $registration->getAppId();
341
+                $this->logger->logException($e, [
342
+                    'message' => "Error during event listener registration of $appId: " . $e->getMessage(),
343
+                    'level' => ILogger::ERROR,
344
+                ]);
345
+            }
346
+        }
347
+    }
348
+
349
+    /**
350
+     * @param App[] $apps
351
+     */
352
+    public function delegateContainerRegistrations(array $apps): void {
353
+        while (($registration = array_shift($this->services)) !== null) {
354
+            try {
355
+                /**
356
+                 * Register the service and convert the callable into a \Closure if necessary
357
+                 */
358
+                $apps[$registration->getAppId()]
359
+                    ->getContainer()
360
+                    ->registerService(
361
+                        $registration->getName(),
362
+                        Closure::fromCallable($registration->getFactory()),
363
+                        $registration->isShared()
364
+                    );
365
+            } catch (Throwable $e) {
366
+                $appId = $registration->getAppId();
367
+                $this->logger->logException($e, [
368
+                    'message' => "Error during service registration of $appId: " . $e->getMessage(),
369
+                    'level' => ILogger::ERROR,
370
+                ]);
371
+            }
372
+        }
373
+
374
+        while (($registration = array_shift($this->aliases)) !== null) {
375
+            try {
376
+                $apps[$registration->getAppId()]
377
+                    ->getContainer()
378
+                    ->registerAlias(
379
+                        $registration->getAlias(),
380
+                        $registration->getTarget()
381
+                    );
382
+            } catch (Throwable $e) {
383
+                $appId = $registration->getAppId();
384
+                $this->logger->logException($e, [
385
+                    'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
386
+                    'level' => ILogger::ERROR,
387
+                ]);
388
+            }
389
+        }
390
+
391
+        while (($registration = array_shift($this->parameters)) !== null) {
392
+            try {
393
+                $apps[$registration->getAppId()]
394
+                    ->getContainer()
395
+                    ->registerParameter(
396
+                        $registration->getName(),
397
+                        $registration->getValue()
398
+                    );
399
+            } catch (Throwable $e) {
400
+                $appId = $registration->getAppId();
401
+                $this->logger->logException($e, [
402
+                    'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
403
+                    'level' => ILogger::ERROR,
404
+                ]);
405
+            }
406
+        }
407
+    }
408
+
409
+    /**
410
+     * @param App[] $apps
411
+     */
412
+    public function delegateMiddlewareRegistrations(array $apps): void {
413
+        while (($middleware = array_shift($this->middlewares)) !== null) {
414
+            try {
415
+                $apps[$middleware->getAppId()]
416
+                    ->getContainer()
417
+                    ->registerMiddleWare($middleware->getService());
418
+            } catch (Throwable $e) {
419
+                $appId = $middleware->getAppId();
420
+                $this->logger->logException($e, [
421
+                    'message' => "Error during capability registration of $appId: " . $e->getMessage(),
422
+                    'level' => ILogger::ERROR,
423
+                ]);
424
+            }
425
+        }
426
+    }
427
+
428
+    /**
429
+     * @return ServiceRegistration<IProvider>[]
430
+     */
431
+    public function getSearchProviders(): array {
432
+        return $this->searchProviders;
433
+    }
434
+
435
+    /**
436
+     * @return ServiceRegistration<IAlternativeLogin>[]
437
+     */
438
+    public function getAlternativeLogins(): array {
439
+        return $this->alternativeLogins;
440
+    }
441
+
442
+    /**
443
+     * @return array[]
444
+     */
445
+    public function getInitialStates(): array {
446
+        return $this->initialStates;
447
+    }
448
+
449
+    /**
450
+     * @return ServiceRegistration<IHandler>[]
451
+     */
452
+    public function getWellKnownHandlers(): array {
453
+        return $this->wellKnownHandlers;
454
+    }
455
+
456
+    /**
457
+     * @return ServiceRegistration<ICustomTemplateProvider>[]
458
+     */
459
+    public function getTemplateProviders(): array {
460
+        return $this->templateProviders;
461
+    }
462 462
 }
Please login to merge, or discard this patch.