Refactor helper drift in lib: centralize theme/translation and remove app() hotspots

This commit is contained in:
2026-03-19 08:23:14 +01:00
parent 5da506a20f
commit 5739cc1200
24 changed files with 197 additions and 88 deletions

View File

@@ -14,7 +14,8 @@ class UserLifecycleRestoreService
private readonly UserReadRepositoryInterface $userReadRepository,
private readonly UserWriteRepositoryInterface $userWriteRepository,
private readonly UserLifecycleAuditService $userLifecycleAuditService,
private readonly DatabaseSessionRepository $databaseSessionRepository
private readonly DatabaseSessionRepository $databaseSessionRepository,
private readonly UserSettingsGateway $userSettingsGateway
) {
}
@@ -171,8 +172,7 @@ class UserLifecycleRestoreService
private function normalizeTheme(mixed $value): string
{
$theme = strtolower(trim((string) $value));
$themes = appThemes();
return isset($themes[$theme]) ? $theme : appDefaultTheme();
$theme = is_scalar($value) ? (string) $value : null;
return $this->userSettingsGateway->normalizeTheme($theme);
}
}