@param array|string $host

@return array
331313
protected function getHosts($host = null): array
    {
        $host = $host ?? config('varnish.host');

        if (! is_array($host)) {
            $host = [$host];
        }

        return $host;
    }
129927
public function show(string $host, array $params = [])
    {
        $path = $this->buildKnownHostsPath($host);

        return $this->get($path, $params);
    }
31783
public function make($host)
    {
        $host = $this->resolver->resolve($host, '/');
        $hash = md5($host);

        if (isset($this->instances[$hash])) {
            return $this->instances[$hash];
        }

        $validator = new Validator(
            $this->validator,
            new ResourceNormalizer
        );
        $instance = new Server(
            $this->capabilities->make($host),
            new Client(
                $this->loader->make($host),
                $this->serializer,
                $this->resolver,
                $validator,
                $this->dispatcher,
                $this->http
            )
        );
        $this->instances[$hash] = $instance;

        return $instance;
    }
404924
public static function parse_host($host) {
		// Try to parse it the easy way.
		$tmp = v_mb::parse_url($host, \PHP_URL_HOST);
		if ($tmp) {
			$host = $tmp;
		}
		// Or the hard way?
		else {
			r_cast::string($host, true);

			r_mb::trim($host);

			// Cut off the path, if any.
			if (false !== ($start = v_mb::strpos($host, '/'))) {
				$host = v_mb::substr($host, 0, $start);
			}

			// Cut off the query, if any.
			if (false !== ($start = v_mb::strpos($host, '?'))) {
				$host = v_mb::substr($host, 0, $start);
			}

			// Cut off credentials, if any.
			if (false !== ($start = v_mb::strpos($host, '@'))) {
				$host = v_mb::substr($host, $start + 1, null);
			}

			// Is this an IPv6 address?
			if (\filter_var($host, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
				r_sanitize::ip($host, true);
			}
			elseif (
				(0 === \strpos($host, '[')) &&
				false !== ($end = v_mb::strpos($host, ']'))
			) {
				$host = v_mb::substr($host, 1, $end - 1);
				r_sanitize::ip($host, true);
			}
			// Cut off port, if any.
			elseif (false !== ($start = v_mb::strpos($host, ':'))) {
				$host = v_mb::substr($host, 0, $start);
			}

			// If it is empty or invalid, there is nothing we can do.
			if (! \strlen($host)) {
				return false;
			}

			// Convert to ASCII if possible.
			if (\function_exists('idn_to_ascii')) {
				$host = \explode('.', $host);
				r_file::idn_to_ascii($host);
				$host = \implode('.', $host);
			}

			// Lowercase it.
			r_mb::strtolower($host, false);

			// Get rid of trailing periods.
			$host = \ltrim($host, '.');
			$host = \rtrim($host, '.');
		}

		// Liberate IPv6 from its walls.
		if (0 === \strpos($host, '[')) {
			$host = \str_replace(array('[', ']'), '', $host);
			r_sanitize::ip($host, true);
		}

		// Is this an IP address? If so, we're done!
		if (\filter_var($host, \FILTER_VALIDATE_IP)) {
			return $host;
		}

		// Look for illegal characters. At this point we should
		// only have nice and safe ASCII.
		if (\preg_match('/[^a-z\d\-\.]/u', $host)) {
			return false;
		}
		$host = \explode('.', $host);
		foreach ($host as $v) {
			// Gotta have length, and can't start or end with a dash.
			if (
				! \strlen($v) ||
				(0 === \strpos($v, '-')) ||
				('-' === \substr($v, -1))
			) {
				return false;
			}
		}

		return \implode('.', $host);
	}
1271007
public function getHostBaseUrl($host = null)
    {
        $config = $this->getFullHost($host);

        return sprintf('%s://%s', $config['protocol'], $config['host']);
    }
960609
public function hasHost($host)
    {
        $this->processFile($this->getFile());

        return array_key_exists($host, $this->hosts);
    }
1132249
public function host($host = null)
    {
        $this->host = empty($host) ? null : $host;

        return $this->host;
    }
411479
public function setHost($host)
    {
        if ($this->validateHost($host) === false) {
            throw new Zend_Uri_Exception("Host \"$host\" is not a valid HTTP host");
        }

        $oldHost     = $this->_host;
        $this->_host = $host;

        return $oldHost;
    }
8030
protected function setHost($host)
    {
        $host = strtolower($host);
        
        if ($host !== '' && !$this->isValidDomain($host) && !$this->isValidIpv4($host) && !$this->isValidIpv6($host)) {
            throw new \InvalidArgumentException("Invalid hostname '$host'");
        }
        
        $this->host = $host;
    }
346427
public function host($host = null)
    {
        if (func_num_args() === 0) {
            $scheme = $this->_classes['scheme'];
            $port = $scheme::port($this->_scheme) !== $this->_port ? $this->_port : null;
            return ($port !== null ? "{$this->_host}:{$port}" : $this->_host);
        }
        if (strpos($host, ':')) {
            list($host, $port) = explode(':', $host);
            $this->port($port);
        }
        $this->_host = $host;
        $headers = $this->headers();
        $headers->prepend('Host', $this->host());
        return $this;
    }
956055
private function getHostConfigurations($hosts)
    {
        $hostConfigurations = array();
        foreach ($hosts as $name => $settings) {
            $host = $settings['host'];
            // Set the key of the host as id.
            $hostConfigurations[$host]['id'] = $name;

            foreach ($settings as $setting => $data) {
                if ($setting === 'locales') {
                    $hostConfigurations[$host]['locales_extra'] = $this->getLocalesExtra($data);
                    $data = $this->getHostLocales($data);
                    $hostConfigurations[$host]['reverse_locales'] = array_flip($data);
                }
                $hostConfigurations[$host][$setting] = $data;
            }
        }

        return $hostConfigurations;
    }
674334
private function getHostIfNull($host)
    {
        if ($host === null) {
            $host = $this->header->get('HOST');
        }

        if ($host === null) {
            $host = $this->server->get('SERVER_NAME');
        }

        if ($host === null) {
            // Return an empty string by default so we can do string operations on it later
            $host = $this->server->get('SERVER_ADDR', '');
        }

        return $host;
    }
230327
public function findConfiguredHost($host)
    {
        list($user, $host) = $this->parseHost($host);

        foreach ($this->groups as $group) {
            if ((isset($group['host']) && $group['host'] == $host) ||
                (isset($group['hostname']) && $group['hostname'] == $host)) {
                if (! empty($user)) {
                    // User is not specified in the SSH configuration...
                    if (! isset($group['user'])) {
                        continue;
                    }

                    // User is specified in the SSH configuration but is not the given user....
                    if (isset($group['user']) && $group['user'] != $user) {
                        continue;
                    }
                }

                return $group['host'];
            }
        }
    }
1258728
public function getRegisteredDomain($host)
    {
        $this->tree = $this->psl->getTree();

        $signingDomain = $this->normalizeHost($host);
        $signingDomainParts = explode('.', $signingDomain);

        $result = $this->findRegisteredDomain($signingDomainParts, $this->tree);

        if (empty($result)) {
            // this is an invalid domain name
            return null;
        }

        // assure there is at least 1 TLD in the stripped signing domain
        if (!strpos($result, '.')) {
            $cnt = count($signingDomainParts);
            if ($cnt == 1 || $signingDomainParts[$cnt-2] == '') {
                return null;
            }
            return $signingDomainParts[$cnt-2] . '.' . $signingDomainParts[$cnt-1];
        }
        return $result;
    }
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);
    }
494279
protected function resolveHost($host)
    {
        if (strpos($host, '://') !== false) {
            list($schema, $host) = explode('://', $host, 2);
        }

        if ($this->schema) {
            $schema = $this->schema;
        }

        if (empty($schema)) {
            $schema = 'http';
        }

        return array($schema, $host);
    }
318751
public final function withHost($host): UriInterface
   {
       if (!is_string($host) || !($parsedHost = $this->parseHost($host))) {
           throw new InvalidArgumentException(
               "Can't get with host: invalid host name");
       }
       return $this->with("host", $parsedHost);
   }