Fixes: centralize helpers, remove dead code, fix JS issues

This commit is contained in:
Laurent Dinclaux
2026-02-10 22:41:11 +11:00
parent da573c184e
commit 05a7a2967f
5 changed files with 57 additions and 68 deletions

View File

@@ -364,21 +364,11 @@ class IdentSwitchForm
}
/**
* Parse scheme prefix from a host string.
*
* @param string $host Host string, optionally prefixed with ssl:// or tls://.
* @return array{scheme: string, host: string} Parsed scheme and bare host.
* Delegate to ident_switch::parse_host_scheme().
*/
private static function parse_host_scheme(string $host): array
{
$lower = strtolower($host);
if (str_starts_with($lower, 'ssl://')) {
return ['scheme' => 'ssl', 'host' => substr($host, 6)];
}
if (str_starts_with($lower, 'tls://')) {
return ['scheme' => 'tls', 'host' => substr($host, 6)];
}
return ['scheme' => '', 'host' => $host];
return ident_switch::parse_host_scheme($host);
}
/**