getHost() public method

public getHost ( ) : string
return string Host
コード例 #1
0
ファイル: ConnectionTest.php プロジェクト: kskod/Elastica
 public function testEmptyConstructor()
 {
     $connection = new Connection();
     $this->assertEquals(Connection::DEFAULT_HOST, $connection->getHost());
     $this->assertEquals(Connection::DEFAULT_PORT, $connection->getPort());
     $this->assertEquals(Connection::DEFAULT_TRANSPORT, $connection->getTransport());
     $this->assertInstanceOf('Elastica\\Transport\\AbstractTransport', $connection->getTransportObject());
     $this->assertEquals(Connection::TIMEOUT, $connection->getTimeout());
     $this->assertEquals(array(), $connection->getConfig());
     $this->assertTrue($connection->isEnabled());
 }
コード例 #2
0
 /**
  * @param ElasticaRequest      $request
  * @param \Elastica\Connection $connection
  *
  * @return string
  */
 protected function _getUri(ElasticaRequest $request, Connection $connection)
 {
     $url = $connection->hasConfig('url') ? $connection->getConfig('url') : '';
     if (!empty($url)) {
         $baseUri = $url;
     } else {
         $baseUri = $this->_scheme . '://' . $connection->getHost() . ':' . $connection->getPort() . '/' . $connection->getPath();
     }
     $baseUri .= $request->getPath();
     $query = $request->getQuery();
     if (!empty($query)) {
         $baseUri .= '?' . http_build_query($query);
     }
     return $baseUri;
 }
コード例 #3
0
ファイル: Guzzle.php プロジェクト: levijackson/Elastica
 /**
  * Builds the base url for the guzzle connection.
  *
  * @param \Elastica\Connection $connection
  *
  * @return string
  */
 protected function _getBaseUrl(Connection $connection)
 {
     // If url is set, url is taken. Otherwise port, host and path
     $url = $connection->hasConfig('url') ? $connection->getConfig('url') : '';
     if (!empty($url)) {
         $baseUri = $url;
     } else {
         $baseUri = (string) Uri::fromParts(['scheme' => $this->_scheme, 'host' => $connection->getHost(), 'port' => $connection->getPort(), 'path' => ltrim('/', $connection->getPath())]);
     }
     return rtrim($baseUri, '/');
 }
コード例 #4
0
ファイル: Guzzle.php プロジェクト: MediaWiki-stable/1.26.1
 /**
  * Builds the base url for the guzzle connection.
  *
  * @param \Elastica\Connection $connection
  */
 protected function _getBaseUrl(Connection $connection)
 {
     // If url is set, url is taken. Otherwise port, host and path
     $url = $connection->hasConfig('url') ? $connection->getConfig('url') : '';
     if (!empty($url)) {
         $baseUri = $url;
     } else {
         $baseUri = $this->_scheme . '://' . $connection->getHost() . ':' . $connection->getPort() . '/' . $connection->getPath();
     }
     return rtrim($baseUri, '/');
 }