ConfigDependencyManager::sortGraph

public static ConfigDependencyManager::sortGraph(array $a, array $b)

Sorts the dependency graph by reverse weight and alphabetically.

Parameters

array $a: First item for comparison. The compared items should be associative arrays that include a 'weight' and a 'name' key.

array $b: Second item for comparison.

Return value

int The comparison result for uasort().

Deprecated

in Drupal 8.2.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Config\Entity\ConfigDependencyManager::prepareMultisort() and array_multisort() instead.

File

core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php, line 263

Class

ConfigDependencyManager
Provides a class to discover configuration entity dependencies.

Namespace

Drupal\Core\Config\Entity

Code

public static function sortGraph(array $a, array $b) {
  $weight_cmp = SortArray::sortByKeyInt($a, $b, 'weight') * -1;

  if ($weight_cmp === 0) {
    return SortArray::sortByKeyString($a, $b, 'name');
  }
  return $weight_cmp;
}
doc_Drupal
2016-10-29 08:52:21
Comments
Leave a Comment

Please login to continue.