You are here

public static function AcquiaSearchSolrApi::getFromSettings in Acquia Connector 7.3

Get API from settings.

Return value

\AcquiaSearchSolrApi API instance.

Throws

\InvalidArgumentException

1 call to AcquiaSearchSolrApi::getFromSettings()
_acquia_search_solr_get_api in acquia_search/includes/acquia_search_solr.helpers.inc
Returns Solr api instance.

File

acquia_search/includes/AcquiaSearchSolrApi.php, line 103

Class

AcquiaSearchSolrApi
Class AcquiaSearchApi.

Code

public static function getFromSettings() {
  $subscription = acquia_agent_settings('acquia_identifier');
  $api_key = acquia_agent_settings('acquia_key');
  $host = variable_get('acquia_search_api_host', 'https://api.sr-prod02.acquia.com');

  // If no UUID explicitly set, get it from subscription data.
  $uuid = variable_get('acquia_uuid', acquia_agent_settings('acquia_subscription_data')['uuid']);
  if (empty($subscription) || empty($api_key) || empty($host) || empty($uuid)) {
    throw new InvalidArgumentException('Please provide API credentials for Acquia Search.');
  }
  return new self($subscription, $api_key, $host, $uuid);
}