WordPress at Your Fingertips
function is not described

Automattic\Jetpack\Autoloader

AutoloadGenerator::sortPackageMap() protected WC 1.0

Sorts packages by dependency weight

Packages of equal weight retain the original order

{} It's a method of the class: AutoloadGenerator{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->sortPackageMap( $packageMap );
$packageMap(array) (required)
The package map.

Code of AutoloadGenerator::sortPackageMap() WC 5.5.2

<?php
protected function sortPackageMap( array $packageMap ) {
	$packages = array();
	$paths    = array();

	foreach ( $packageMap as $item ) {
		list( $package, $path ) = $item;
		$name                   = $package->getName();
		$packages[ $name ]      = $package;
		$paths[ $name ]         = $path;
	}

	$sortedPackages = PackageSorter::sortPackages( $packages );

	$sortedPackageMap = array();

	foreach ( $sortedPackages as $package ) {
		$name               = $package->getName();
		$sortedPackageMap[] = array( $packages[ $name ], $paths[ $name ] );
	}

	return $sortedPackageMap;
}