function 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 'name' key.

array $b: Second item for comparison.

Return value

int The comparison result for uasort().

Deprecated

in drupal:8.2.0 and is removed from 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.