Sets Host header if preserve host is true.

@param string $headerHost
@param string $host
return string[][]
497289
protected function setPreserveHost(string $headerHost, string $host)
        {
            $header = [];
            if ($host !== '' && $headerHost === '') {
                $header = [
                    'original' => 'HTTP_HOST', 
                    'values'   => [$host]
                ];
            }
            return $header;
        }
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");
            }
        }
    }
1053279
public function withHost(string $host): URI
    {
        $result = clone $this;
        $result->host = $this->filterHost($host);

        return $result;
    }
493145
public function hostMatches($host)
    {
        $pattern = '@^' . str_replace('\*', '.*', preg_quote($this->options['_host'], '@')) . '$@';

        return preg_match($pattern, $host) !== 0;
    }
1267745
public function getHostGroupsByHost(Host $host)
    {
        return array_values(
            array_filter(
                $this->hostGroups,
                function ($g) use ($host) {
                    return $g->hasHost($host);
                }
            )
        );
    }
687638
protected function filterHost($host)
    {
        if ($host) {
            if (filter_var($host, FILTER_VALIDATE_IP)) {
                $host = strval($host);
            } elseif (preg_match(
                '/^(?:[' . self::CHARACTERS_UNRESERVED . self::CHARACTERS_SUB_DELIMS . ':@\/\?]+|%[A-Fa-f0-9]{2})+$/',
                $host
            )
            ) {
                $host = strval($host);
            } else {
                throw new InvalidArgumentException('Invalid host "%s".', $host);
            }
        } else {
            $host = '';
        }

        return $host;
    }
297907
protected function setHeaders(array $headers)
    {
        $this->headers = [];
        
        foreach ($headers as $name => $values) {
            $this->assertHeaderName($name);
            $this->assertHeaderValue($values);
        
            $key = strtolower($name);
            $this->headers[$key] = ['name' => $name, 'values' => (array)$values];
        }
    }
1175673
private function formatHost(?string $host): ?string
    {
        if (null === $host || '' === $host) {
            return $host;
        }

        if ('[' !== $host[0]) {
            return $this->formatRegisteredName($host);
        }

        return $this->formatIp($host);
    }
694746
public function withHost($host)
    {
        $uri = $this->getUri()->withHost($host);

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

        return $clone;
    }
534053
public function setHost($host = null)
    {
        if ($host === null) {
            $host = '127.0.0.1';
        }

        if (substr($host, 0, 6) == 'ssl://') {
            $this->_protocol = 'ssl';
            $this->_secure = 'ssl';
            $host = substr($host, 6);
        }
        $this->_host = $host;
    }
591986
protected function prepareHeaders($server)
    {
        $output = [];

        if (!is_array($server)) {
            return $output;
        }

        foreach ($server as $key => $value) {
            if (is_string($key) && strlen($key) > 5 && strpos($key, 'HTTP_') !== false) {
                $output[substr($key, 5)] = $value;
            }
        }

        return $output;
    }
110667
public function getDefinitionByHost($host)
    {
        $searchEngines = $this->getDefinitions();

        if (!array_key_exists($host, $searchEngines)) {
            return array();
        }

        return $searchEngines[$host];
    }
28564
public function setHost(Host $host)
    {
        $this->host = $host;

        if ($this->status != self::STATUS_NEW) {
            throw new \RuntimeException('Cannot set worker host after worker has started working');
        }
    }
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;
    }
371294
public function setHost($host)
  {
    if ($this->isLocked()) {
      return $this->getObj()->setHost($host)->setLocked();
    } else {
      return parent::setHost($host);
    }
  }
569115
public function setHost($host)
    {
        if (substr($host, -1) === '/') {
            $host = substr($host, 0, strlen($host) - 1);
        }

        $this->host = $host;
    }
880028
function SetServer ( $host, $port = 0 )
    {
        assert ( is_string($host) );
        if ( $host[0] == '/')
        {
            $this->_path = 'unix://' . $host;
            return;
        }
        if ( substr ( $host, 0, 7 )=="unix://" )
        {
            $this->_path = $host;
            return;
        }

        $this->_host = $host;
        $port = intval($port);
        assert ( 0<=$port && $port<65536 );
        $this->_port = ( $port==0 ) ? 9312 : $port;
        $this->_path = '';
    }