'text/plain']; $headerValue = $this->resolveRemoteUser($id, $config); if (null !== $headerValue) { $headers['Remote-User'] = $headerValue; } return new Response("hi $id", headers: $headers); } /** * Resolve the Remote-User header value based on the configured mode. * Returns null when the header should not be sent. */ private function resolveRemoteUser(string $id, ConfigBag $config): ?string { return match ($config->remoteUserMode()) { RemoteUserMode::Session => $id, RemoteUserMode::Static => $config->remoteUserStatic(), RemoteUserMode::Mapped => $config->remoteUserMap()[$id] ?? $id, RemoteUserMode::None => null, }; } }