protected function parseHostString($host_str)
{
if (preg_match('/\\A([a-zA-Z0-9_.-]+)(:([0-9]+))?\\z/', $host_str, $matches)) {
$host = $matches[1];
$port = isset($matches[3]) ? $matches[3] : static::DEFAULT_PORT;
if ($port > 0 && $port <= 65535) {
return array('host' => $host, 'port' => $port, 'hash' => "{$host}:{$port}");
}
}
throw new MongoConnectionException('malformed host string: ' . $host_str);
}