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