Sets the host for this URL.

@param string $host The hostname or IP address for this URL.

@throws InvalidArgumentException If the given host is not an IP address or hostname.

@return void
1105
public function setHost($host)
    {
        if (! (self::_isHostname($host) || self::_isIpAddress($host))) {

            throw new InvalidArgumentException("Invalid host ($host)");
        }

        $this->_host = strtolower(trim($host));
    }
281378
public final void setHost(final String host) throws UnknownHostException {
        this.host = host;
        final InetAddress[] inetAddresses = InetAddress.getAllByName(host);

        for (InetAddress address: inetAddresses) {
            final AddressHostMatcher matcher = new AddressHostMatcher();
            matcher.setIp(address.getHostAddress());
            this.matchersForHost.add(matcher);
        }
    }
1132249
public function host($host = null)
    {
        $this->host = empty($host) ? null : $host;

        return $this->host;
    }
281461
public void setHost(String host) throws IllegalStateException {
        if (host == null) {
            throw new IllegalArgumentException("host parameter is null");
        }
        assertNotOpen();
        hostName = host;
    }
694746
public function withHost($host)
    {
        $uri = $this->getUri()->withHost($host);

        /** @var static $clone */
        $clone = $this->withUri($uri);

        return $clone;
    }
235186
public function addHost(Host $host)
    {
        if (empty($host)) return $this;

        $this->_host_list["{$host->name}:{$host->port}"] = $host;

        return $this;
    }
1164620
protected function setHost($host, $port = null)
    {
        $this->host = $host;
        if ($port !== null) {
            if (is_numeric($port)) {
                $this->port = (int) $port;
            } else {
                throw new ConfigurationException("Port '{$port}' is not numeric");
            }
        }
    }
881844
public function setHost($host)
    {
        if (strpos($host, ':') === false) {
            $this->host = $host;
        } else {
            list($host, $port) = explode(':', $host);
            $this->host = $host;
            $this->setPort($port);
        }

        return $this;
    }
928213
protected function setIp($ip)
    {
        if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
            throw new \InvalidArgumentException('$ip must be correct');
        }

        $this->ip = $ip;
    }
1345182
public static function setHost($host) {

		if(false === is_string($host)) {
  			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($host)), E_USER_ERROR);
  		}

		$_SERVER['HTTP_HOST'] = $host;
	}
378889
public function host($host = '') {
        if ($host) {
            $this->host = $host;
        }
        if (!$this->host) {
            $this->host = self::server('HTTP_HOST');
        }
        return $this->host;
    }
580579
public function setLink(string $host, Link $link): void
    {
        $this->links[$host] = $link;
    }
840545
public static function isLocalHost($host)
    {
        if (empty($host)) {
            return false;
        }

        // remove port
        $hostWithoutPort = explode(':', $host);
        array_pop($hostWithoutPort);
        $hostWithoutPort = implode(':', $hostWithoutPort);

        $localHostnames = Url::getLocalHostnames();
        return in_array($host, $localHostnames, true)
            || in_array($hostWithoutPort, $localHostnames, true);
    }
305434
public function checkPermission($host, $context)
    {
        if (!is_string($host)) {
            throw new \TypeError('The host parameter must be a string.');
        }
        if (!$host) {
            throw new \InvalidArgumentException('The host parameter cannot be empty.');
        }

        $currentRequest = $this->requestStack->getCurrentRequest();

        if (!$currentRequest) {
            return false;
        }

        return !!preg_match('{'.$host.'}i', $currentRequest->getHost());
    }
497289
protected function setPreserveHost(string $headerHost, string $host)
        {
            $header = [];
            if ($host !== '' && $headerHost === '') {
                $header = [
                    'original' => 'HTTP_HOST', 
                    'values'   => [$host]
                ];
            }
            return $header;
        }
973917
private function setDroidIpToPrivateIp($host)
    {
        if ($host->droid_ip
            || ! $this->getEnvironment()
            || $this->getEnvironment()->droid_use_private_net !== true
        ) {
            return;
        }

        if (! $host->private_ip) {
            throw new RuntimeException(
                sprintf(
                    'I am unable to add "%s" to the Inventory because it is missing the "private_ip" required by the environment setting "droid_use_private_net".',
                    $host->getName()
                )
            );
        }

        $host->droid_ip = $host->private_ip;
    }
264595
public function setAddress(string $address = null) : void
    {
        if (!is_null($address) && !filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) {
            Utils::getContainer()->getLogger()->warning(sprintf('Provided argument (%s) is not a valid IP address.', $address));
        }
        $this->Address = $address;
    }