You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the addition of Elastica/Transport/Guzzle (in #618 ) which is an alternative to Elastica/Transport/Http (and Https), there are two classes that implement the ElasticSearch JSON over HTTP protocol. Which should allow some level of refactoring, following the discussion in #618 how about something very roughly along the lines of this:
abstract class AbstractHttpTransport extends AbstractTransport {
public function exec (Request $request, array $params);
$connection = $this->_getHttpConnection();
$request = $this->_createRequest();
$response = $this->_sendRequest($request);
}
protected function _getBaseUri() {
$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, '/');
}
protected function _setContent() {
return (is_array($data)) ? JSON::stringify($data, 'JSON_ELASTICSEARCH') : $data;
}
abstract protected function _getHttpConnection();
abstract protected function _createRequest();
abstract protected function _sendRequest();
}
Then have Http and Guzzle extend AbstractHttpTransport and implement the abstract methods, although I'm fine with just extracting the common code into a BaseHttp class?
The text was updated successfully, but these errors were encountered:
With the addition of Elastica/Transport/Guzzle (in #618 ) which is an alternative to Elastica/Transport/Http (and Https), there are two classes that implement the ElasticSearch JSON over HTTP protocol. Which should allow some level of refactoring, following the discussion in #618 how about something very roughly along the lines of this:
Then have Http and Guzzle extend AbstractHttpTransport and implement the abstract methods, although I'm fine with just extracting the common code into a BaseHttp class?
The text was updated successfully, but these errors were encountered: