eZ\Publish\Core\Search\Elasticsearch\Content\Gateway\HttpClient\Stream::__construct PHP Method

__construct() public method

Constructs a new REST client instance for the given $server.
public __construct ( string $server )
$server string Remote server location. Must include the used protocol.
    public function __construct($server)
    {
        $url = parse_url(rtrim($server, '/'));
        $url += array('scheme' => 'http', 'host' => null, 'port' => null, 'user' => null, 'pass' => null, 'path' => null);
        if ($url['user'] || $url['pass']) {
            $this->headers['Authorization'] = 'Basic ' . base64_encode("{$url['user']}:{$url['pass']}");
        }
        $this->server = $url['scheme'] . '://' . $url['host'];
        if ($url['port']) {
            $this->server .= ':' . $url['port'];
        }
        $this->server .= $url['path'];
    }