protected function SolrConnectorPluginBase::createClient in Search API Solr 8
Same name and namespace in other branches
- 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::createClient()
- 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::createClient()
Create a Client.
2 calls to SolrConnectorPluginBase::createClient()
- SolrConnectorPluginBase::connect in src/
SolrConnector/ SolrConnectorPluginBase.php - Prepares the connection to the Solr server.
- SolrConnectorPluginBase::validateConfigurationForm in src/
SolrConnector/ SolrConnectorPluginBase.php - Form validation handler.
File
- src/
SolrConnector/ SolrConnectorPluginBase.php, line 321
Class
- SolrConnectorPluginBase
- Defines a base class for Solr connector plugins.
Namespace
Drupal\search_api_solr\SolrConnectorCode
protected function createClient(array &$configuration) {
$configuration[self::QUERY_TIMEOUT] = $configuration['timeout'] ?? 5;
$adapter = NULL;
if (extension_loaded('curl')) {
$adapter = new Curl($configuration);
}
else {
$adapter = new Http();
$adapter
->setTimeout($configuration[self::QUERY_TIMEOUT]);
}
unset($configuration['timeout']);
return new Client($adapter, $this->eventDispatcher);
}