You are here

public function ConfigDependencyManager::sortGraph in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php \Drupal\Core\Config\Entity\ConfigDependencyManager::sortGraph()

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 'component' key.

array $b: Second item for comparison.

Return value

int The comparison result for uasort().

File

core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php, line 211
Contains \Drupal\Core\Config\Entity\ConfigDependencyManager.

Class

ConfigDependencyManager
Provides a class to discover configuration entity dependencies.

Namespace

Drupal\Core\Config\Entity

Code

public function sortGraph(array $a, array $b) {
  $weight_cmp = SortArray::sortByKeyInt($a, $b, 'weight') * -1;
  if ($weight_cmp === 0) {
    return SortArray::sortByKeyString($a, $b, 'component');
  }
  return $weight_cmp;
}