Elastica\Transport\Guzzle::exec PHP Метод

exec() публичный Метод

All calls that are made to the server are done through this function
public exec ( Request $request, array $params ) : Response
$request Elastica\Request
$params array Host, Port, ...
Результат Elastica\Response Response object
    public function exec(Request $request, array $params)
    {
        $connection = $this->getConnection();
        $client = $this->_getGuzzleClient($this->_getBaseUrl($connection), $connection->isPersistent());
        $options = ['exceptions' => false];
        if ($connection->getTimeout()) {
            $options['timeout'] = $connection->getTimeout();
        }
        $proxy = $connection->getProxy();
        // See: https://github.com/facebook/hhvm/issues/4875
        if (is_null($proxy) && defined('HHVM_VERSION')) {
            $proxy = getenv('http_proxy') ?: null;
        }
        if (!is_null($proxy)) {
            $options['proxy'] = $proxy;
        }
        $req = $this->_createPsr7Request($request, $connection);
        try {
            $start = microtime(true);
            $res = $client->send($req, $options);
            $end = microtime(true);
        } catch (TransferException $ex) {
            throw new GuzzleException($ex, $request, new Response($ex->getMessage()));
        }
        $response = new Response((string) $res->getBody(), $res->getStatusCode());
        $response->setQueryTime($end - $start);
        if ($connection->hasConfig('bigintConversion')) {
            $response->setJsonBigintConversion($connection->getConfig('bigintConversion'));
        }
        $response->setTransferInfo(['request_header' => $request->getMethod(), 'http_code' => $res->getStatusCode()]);
        if ($response->hasError()) {
            throw new ResponseException($request, $response);
        }
        if ($response->hasFailedShards()) {
            throw new PartialShardFailureException($request, $response);
        }
        return $response;
    }