You are here

protected function PackageManager::buildMergedExtensionPackage in Composer Manager 8

Builds a package containing the merged fields of all extension packages.

Used for reporting purposes only (getRequiredPackages()).

Return value

array An array with the following keys:

  • 'require': The merged requirements
  • 'require-dev': The merged dev requirements.
1 call to PackageManager::buildMergedExtensionPackage()
PackageManager::getRequiredPackages in src/PackageManager.php
Returns the required packages.

File

src/PackageManager.php, line 250

Class

PackageManager
Manages composer packages.

Namespace

Drupal\composer_manager

Code

protected function buildMergedExtensionPackage() {
  $package = [
    'require' => [],
    'require-dev' => [],
  ];
  $keys = array_keys($package);
  foreach ($this
    ->getExtensionPackages() as $extension_package) {
    foreach ($keys as $key) {
      if (isset($extension_package[$key])) {
        $package[$key] = array_merge($extension_package[$key], $package[$key]);
      }
    }
  }
  $package['require'] = $this
    ->filterPlatformPackages($package['require']);
  $package['require-dev'] = $this
    ->filterPlatformPackages($package['require-dev']);
  return $package;
}