Recupera o host da conexão.

@return string

@throws \BadMethodCallException Se a conexão não tiver sido inicializada.
340050
public function getHost()
    {
        if ($this->initialized) {
            $hostname = $this->getHostName();

            if (($this->secure && $this->port != self::HTTPS_PORT) ||
                 (!$this->secure && $this->port != self::HTTP_PORT)) {
                $hostname .= ':'.$this->port;
            }

            return $hostname;
        }

        throw new BadMethodCallException('Connection not initialized');
    }
1337263
public function getConnection()
    {
        // Initiate connection if not exist
        if ($this->connection === null) {
            $this->connection = DriverManager::getConnection($this->dsn);
        }

        return $this->connection;
    }
1276290
public function toString()
   {
      if ( empty( $this->_hostName ) )
      {
         if ( \is_null( $this->_tld ) )
         {
            return '';
         }
         return $this->_tld->toString();
      }
      if ( \is_null( $this->_tld ) )
      {
         return $this->_hostName;
      }
      return $this->_hostName . '.' . $this->_tld->toString();
   }
623585
protected function assembleHost() {
		if ($this->host === null) {
			return '/';
		}
		
		if ($this->port === null) {
			return $this->host;
		}
		
		return $this->host . ':' . $this->port;
	}
232176
public function getDomain()
    {
        $result = $this->host;
        if(null !== $this->port)
        {
            $result .= ':' . $this->port;
        }
        return $result;
    }
33476
public function getLocationUsingProvider()
    {
        $providerId = Common::getRequestVar('id');
        $provider = LocationProvider::getProviderById($providerId);
        if (empty($provider)) {
            throw new Exception("Invalid provider ID: '$providerId'.");
        }

        $location = $provider->getLocation(array('ip'                => IP::getIpFromHeader(),
                                                 'lang'              => Common::getBrowserLanguage(),
                                                 'disable_fallbacks' => true));
        $location = LocationProvider::prettyFormatLocation(
            $location, $newline = '<br/>', $includeExtra = true);

        return $location;
    }
31019
public function getHostName()
    {
        $remoteAddress = $this->server()->remoteAddress();

        $host = $this->server()->serverName();
        $fwdHost = $this->server()->get($this->getTrustedHeaders()['client_host']);
        if ($fwdHost && $fwdHost != '' && in_array($remoteAddress, $this->getTrustedProxies())) {
            $host = $fwdHost;
        }

        return strtolower($host);
    }
100998
private function getRemoteHostname()
    {
        $hostname = NULL;

        if(!is_null($this->ip)) {
            $hostname = gethostbyaddr($this->ip);
        }
        return $hostname;
    }
406925
function getHost()
    {
        if ($this->host)
            return $this->host;
        
        // attempt to get host from target uri
        $host  = $this->getTarget();
        $host  = parse_url($host, PHP_URL_HOST);
        if (!$host && $this->headers()->has('Host')) {
            /** @var iHeader $host */
            $host = $this->headers()->get('Host');
            $host = $host->renderValueLine();
        }

        return $host;
    }
32035
public function getConnection()
    {
        if ($this->connection) {
            return $this->connection;
        }

        return $this->connection = new SFTP($this->host, $this->port, $this->timeout);
    }
1268067
public synchronized final String getHost() {
        if (host == null) {
            InetSocketAddress adr = getEndpointAddress();
            
            if ( adr != null && !adr.isUnresolved()) {
                host = getEndpointAddress().getHostName();
            }
        }

        return host;
    }
139588
public function getJumpHost()
    {
        if ($config = $this->getInspectorConfiguration('jumptags')) {
            $ec2Repository = new Repository();
            $instances = $ec2Repository->findEc2InstancesByTags($config);
            if (count($instances) == 0) {
                throw new \Exception('Could not find jump host for: ' . var_export($config, true));
            }
            return $instances->getFirst();
        }
        return null;
    }
889932
public function getHost()
    {
        if ($this->isUsingTrustedProxy() && $this->header->has(self::$trustedHeaderNames[RequestHeaderConstants::CLIENT_HOST])) {
            $hosts = explode(',', $this->header->get(self::$trustedHeaderNames[RequestHeaderConstants::CLIENT_HOST]));
            $host = trim(end($hosts));
        } else {
            $host = $this->header->get('X_FORWARDED_FOR');
        }

        $host = $this->getHostIfNull($host);

        // Remove the port number
        $host = strtolower(preg_replace('/:\d+$/', '', trim($host)));

        // Check for forbidden characters
        if (!empty($host) && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) {
            throw new \UnexpectedValueException("Invalid host $host");
        }

        return $host;
    }
803207
public function getConnection()
	{
		if ($this->connection) return $this->connection;

		return $this->connection = new Net_SFTP($this->host, $this->port);
	}
289866
public function getHostName()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Hostname');
        }

        // File containing info
        $file = '/proc/sys/kernel/hostname';

        // Get it
        $hostname = Common::getContents($file, false);

        // Failed?
        if ($hostname === false) {
            Errors::add('Linfo Core', 'Error getting /proc/sys/kernel/hostname');

            return 'Unknown';
        }

        // Didn't fail; return it
        return $this->ensureFQDN($hostname);
    }
981043
public function getHostWithPort()
    {
        if ($this->hasPort() && (!$this->hasDefaultPort() || !$this->isPortDefault())) {
            return $this->getHost() . ':' . $this->getPort();
        } else {
            return $this->getHost();
        }
    }
476830
protected function getConnection()
    {
        $hosts = $this->getHostList();

        while ($host = array_shift($hosts)) {
            try {
                return $this->connectSocket($host);
            } catch (ConnectionException $connectionException) {
                if (empty($hosts)) {
                    throw new ConnectionException("Could not connect to a broker", [], $connectionException);
                }
            }
        }
    }