refactor: remove 13 dead code artifacts across core/
Dead methods (9): - Command::bootstrapModuleApp() — unused by all subclasses - SearchConfig::providerCoverageGaps() — diagnostic method, never called - RequestInput::queryArray() — no callers - LocaleResolver::getAvailableLocales() / getDefaultLocale() — unused getters - EmailVerificationService::getExpiryMinutes() — constant wrapper, never called - AuthService::loginAndRedirect() — convenience wrapper, never called - DepartmentService::listForUserAssignments() — no callers - UserTenantContextService::getAvailableDepartmentsByTenant() — no callers Dead functions (3): - navActivePublicPages(), appNormalizeStringList(), appNormalizePositiveIntList() Dead constant (1): - PermissionService::API_DOCS_VIEW — duplicated via other paths Orphaned file (1): - bin/cli-bootstrap.php — never included anywhere Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -132,48 +132,6 @@ class UserTenantContextService
|
||||
return $tenants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available departments grouped by tenant for a user.
|
||||
* Returns an array of groups: ['tenant' => [...], 'departments' => [...]]
|
||||
*/
|
||||
public function getAvailableDepartmentsByTenant(int $userId): array
|
||||
{
|
||||
$tenants = $this->getAvailableTenants($userId);
|
||||
if (!$tenants) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$groups = [];
|
||||
foreach ($tenants as $tenant) {
|
||||
$tenantId = (int) ($tenant['id'] ?? 0);
|
||||
if ($tenantId <= 0) {
|
||||
continue;
|
||||
}
|
||||
$departments = $this->directoryGateway->listDepartmentsByTenantIds([$tenantId]);
|
||||
usort($departments, static function ($a, $b) {
|
||||
return strcmp((string) ($a['description'] ?? ''), (string) ($b['description'] ?? ''));
|
||||
});
|
||||
$departments = array_map(static function (array $department): array {
|
||||
return [
|
||||
'id' => (int) ($department['id'] ?? 0),
|
||||
'uuid' => $department['uuid'] ?? '',
|
||||
'description' => $department['description'] ?? '',
|
||||
];
|
||||
}, $departments);
|
||||
|
||||
$groups[] = [
|
||||
'tenant' => [
|
||||
'id' => (int) ($tenant['id'] ?? 0),
|
||||
'uuid' => $tenant['uuid'] ?? '',
|
||||
'description' => $tenant['description'] ?? '',
|
||||
],
|
||||
'departments' => $departments,
|
||||
];
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current tenant for a user (with validation)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user