protected function PackageManager::processRequiredPackages in Composer Manager 8
Formats and sorts the provided list of packages.
Parameters
array $packages: The packages to process.
Return value
array The processed packages.
1 call to PackageManager::processRequiredPackages()
- PackageManager::getRequiredPackages in src/
PackageManager.php - Returns the required packages.
File
- src/
PackageManager.php, line 154
Class
- PackageManager
- Manages composer packages.
Namespace
Drupal\composer_managerCode
protected function processRequiredPackages(array $packages) {
foreach ($packages as $package_name => $package) {
// Ensure the presence of all keys.
$packages[$package_name] += [
'constraint' => '',
'description' => '',
'homepage' => '',
'require' => [],
'required_by' => [],
'version' => '',
];
// Sort the keys to ensure consistent results.
ksort($packages[$package_name]);
}
// Sort the packages by package name.
ksort($packages);
// Add information about dependent packages.
$extension_packages = $this
->getExtensionPackages();
foreach ($packages as $package_name => $package) {
foreach ($extension_packages as $extension_name => $extension_package) {
if (isset($extension_package['require'][$package_name])) {
$packages[$package_name]['required_by'] = [
$extension_package['name'],
];
break;
}
}
}
return $packages;
}