You are here

public function PreferredSearchCoreService::getPreferredCore in Acquia Connector 7.2

Same name and namespace in other branches
  1. 8 acquia_search/src/PreferredSearchCoreService.php \Drupal\acquia_search\PreferredSearchCoreService::getPreferredCore()
  2. 7.3 acquia_search/src/PreferredSearchCoreService.php \Drupal\acquia_search\PreferredSearchCoreService::getPreferredCore()

Returns the preferred core from the list of available cores.

Return value

array|null NULL or [ 'balancer' => 'useast11-c4.acquia-search.com', 'core_id' => 'WXYZ-12345.dev.mysitedev', ].

3 calls to PreferredSearchCoreService::getPreferredCore()
PreferredSearchCoreService::getPreferredCoreId in acquia_search/src/PreferredSearchCoreService.php
Returns expected core ID based on the current site configs.
PreferredSearchCoreService::getPreferredCoreUrl in acquia_search/src/PreferredSearchCoreService.php
Returns URL for the preferred search core.
PreferredSearchCoreService::isPreferredCoreAvailable in acquia_search/src/PreferredSearchCoreService.php
Determines whether the expected core ID matches any available core IDs.

File

acquia_search/src/PreferredSearchCoreService.php, line 79

Class

PreferredSearchCoreService
Class PreferredSearchCoreService.

Namespace

Drupal\acquia_search

Code

public function getPreferredCore() {
  $expected_cores = $this
    ->getListOfPossibleCores();
  foreach ($expected_cores as $expected_core) {
    foreach ($this->available_cores as $available_core) {
      if ($expected_core == $available_core['core_id']) {
        return $available_core;
      }
    }
  }
}