MongoClient::parseHostString PHP Метод

parseHostString() защищенный Метод

Given a host string, validate and parse it into hostname and port parts
protected parseHostString ( $host_str ) : array
$host_str string - The host:port string
Результат array - In the form ['host' => $host, 'port' => $port, 'hash' => "$host:$port"]
    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);
    }