function set_host($host)
{
if ($host === null || $host === '') {
$this->host = null;
$this->valid[__FUNCTION__] = true;
return true;
} elseif ($host[0] === '[' && substr($host, -1) === ']') {
if (Net_IPv6::checkIPv6(substr($host, 1, -1))) {
$this->host = $host;
$this->valid[__FUNCTION__] = true;
return true;
} else {
$this->host = null;
$this->valid[__FUNCTION__] = false;
return false;
}
} else {
$this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE);
$this->valid[__FUNCTION__] = true;
return true;
}
}