You are here

protected function PreferredSearchCoreService::sortCores in Acquia Search 2.x

Sorts and returns search cores.

It puts v3 cores first.

Parameters

array $cores: Unsorted array of search cores.

Return value

array Array of search cores. V3 cores in the begging of the result array.

1 call to PreferredSearchCoreService::sortCores()
PreferredSearchCoreService::getPreferredCore in src/PreferredSearchCoreService.php
Returns the preferred core from the list of available cores.

File

src/PreferredSearchCoreService.php, line 174

Class

PreferredSearchCoreService
Serivce to check for preferred search core.

Namespace

Drupal\acquia_search

Code

protected function sortCores(array $cores) {
  $v3_cores = array_filter($cores, function ($core) {
    return $this
      ->isCoreV3($core);
  });
  $regular_cores = array_filter($cores, function ($core) {
    return !$this
      ->isCoreV3($core);
  });
  return array_merge($v3_cores, $regular_cores);
}