Set the database server's hostname, and port (if any).

@param  string $hostname - format: "hostname[:port]"

@return $this
495492
protected function setHost($hostname) {
        if (!is_string($hostname)) throw new IllegalTypeException('Illegal type of parameter $hostname: '.gettype($hostname));
        if (!strlen($hostname))    throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (empty)');

        $host = $hostname;
        $port = null;

        if (strpos($host, ':') !== false) {
            list($host, $port) = explode(':', $host, 2);
            $host = trim($host);
            if (!strlen($host)) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (empty host name)');

            $port = trim($port);
            if (!ctype_digit($port)) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (not a port)');
            $port = (int) $port;
            if (!$port || $port > 65535) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (illegal port)');
        }

        $this->host = $host;
        $this->port = $port;
        return $this;
    }
63797
public function setPeername($host, $port)
    {
        $this->host = $host;
        $this->port = $port;
        $this->addr = '[' . $this->host . ']:' . $this->port;
        if ($this->pool->allowedClients !== null) {
            if (!TCP::netMatch($this->pool->allowedClients, $this->host)) {
                Daemon::log('Connection is not allowed (' . $this->host . ')');
                $this->ready = false;
                $this->finish();
            }
        }
    }
818279
public function setDbName($dbName = null)
    {
        $this->dbName = ($dbName === null ? Propel::getDefaultDB() : $dbName);
    }
916312
public function setIsolation(string $isolation)
    {
        $this->isolation = $isolation;

        $this->hostConfig = array_merge($this->hostConfig, ['Isolation' => $isolation]);

        return $this;
    }
1158975
public function setServer($host, $port = 6379)
    {
        $this->host = $host;
        $this->port = $port ? $port : $this->port;
    }
149085
public function setGearmanHost(string $hostname) : void
    {
        if (empty($hostname)) {
            throw new ManagerException('Hostname can not be empty.');
        }
        $this->gearmanHost = $hostname;
    }
1181509
public static function isHostnameIP($hostname)
  {
    // IP-literal: encased in square brackets
    // we match starting [ character followed by non ] characters followed by ] character as last character in hostname
    if(preg_match('/^\[[^\]]\]$/',$hostname)){
      // ok its an IP-literal, we do not parse the literal to see if its valid
      return true;
    }
    // IPv4 in decimal
    if(preg_match('/^[0-9]+$/',$hostname)){
      // ok its a number
      // lets see if its in the 32bit range
      $ip4_hex=base_convert($hostname, 10, 16);
      if(strlen($ip4_hex)<=8){
        // ok, hex representation is less than 9 chars, so thats max FFFFFFFF
        return true;
      }
    }
    $ip_parts=Array();
    if(!preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/',$hostname,$ip_parts)){
      return false;
    }
    // check if each block is in byte range (hard to test with regex)
    for($j=1;$j<=4;$j++){
      if(($ip_parts[$j]>255) || ($ip_parts[$j]<0)){
        return false;
      }
    }
    return true;
  }
1123982
public function setUsername($username)
    {
        if (mb_strlen($username) == 0) {
            $this->throwError('Username not set');
        }

        $this->username = $username;

        return $this;
    }
629911
public function setDisplayName($displayName)
    {
        if (null !== $displayName) {
            Assert::string($displayName, 'The display name must be a string. Got: %s');
            Assert::notEmpty($displayName, 'The display name must not be empty.');
        }

        $this->displayName = $displayName;

        return $this;
    }
120633
public function setName($routeName)
    {
        $lastMethod = $this->lastRouteMethod;
        $lastIndex = count($this->routes[$lastMethod])-1;
        $indexName = $lastMethod.':'.$lastIndex;
        $this->routeNames[$indexName] = $routeName;

        $rota = $this->routes[$lastMethod][$lastIndex];
        $rota->setName($routeName);
        $this->routes[$lastMethod][$lastIndex] = $rota;

        return $this;
    }
422079
public function setPort($port)
    {
        if ( ! is_null($port)) $port = (int) $port;

        $this->setAttribute('port', $port);

        return $this;
    }
291081
public void setServerName(String serverName) {
    if (serverName == null || serverName.equals("")) {
      this.serverName = "localhost";
    } else {
      this.serverName = serverName;
    }
  }
1004435
public void setHostName(String hostName) {
        if (hostName == null || hostName.contains(":")) {
            return;
        }
        ODO_HOST = hostName;
        BASE_URL = "http://" + ODO_HOST + ":" + API_PORT + "/" + API_BASE + "/";
    }
730076
public function setName($name)
    {
        if (empty($name))
            throw new \Exception('Invalid characters in database name:'.$name);
        $this->name = $name;
        return $this;
    }
624871
public void addHostName(String hostName) {
		if(logger.isDebugEnabled()) {
			logger.debug(this);
			logger.debug("Adding hostname "+ hostName);
		}
		hostNames.add(hostName);
		if(dnsServerLocator != null) {
			dnsServerLocator.addLocalHostName(hostName);
		}
	}
400017
public function execute($hostname)
    {
        $server = $this->getContext();
        $query  = $hostname. '.' . $server->getHostname();

        $result = @$this->query($query);

        $response = new Response\NetDnsResponse();
        $response->setHostname($hostname);
        $response->setServer($server);
        $response->setQuery($query);

        if ($result) {
            $response->listed();

            $answer = '';
            $resultTXT = @$this->query($query, 'TXT');
            if ($resultTXT) {
                foreach ($resultTXT->answer as $txt) {
                    $answer .= $txt->text[0];
                }
            }

            $response->setAnswer($answer);
        }

        return $response;
    }
938731
public function setName($name)
    {
        list($domain, $locale, $extention) = explode('.', $name);

        $this
            ->setDomain($domain)
            ->setLocale($locale)
            ->setExtention($extention)
        ;

        return $this;
    }