You are here

public function DrupalPinnedDevDependenciesBuilder::getPackage in Drupal 9

Same name and namespace in other branches
  1. 8 composer/Generator/Builder/DrupalPinnedDevDependenciesBuilder.php \Drupal\Composer\Generator\Builder\DrupalPinnedDevDependenciesBuilder::getPackage()

Generate the Composer.json data for the current tag or branch.

Return value

array Composer json data.

Overrides BuilderInterface::getPackage

File

composer/Generator/Builder/DrupalPinnedDevDependenciesBuilder.php, line 22

Class

DrupalPinnedDevDependenciesBuilder
Builder to produce metapackage for drupal/core-dev-pinned.

Namespace

Drupal\Composer\Generator\Builder

Code

public function getPackage() {
  $composer = $this
    ->initialPackageMetadata();

  // Pull the exact versions of the dependencies from the composer.lock
  // file and use it to build our 'require' section.
  $composerLockData = $this->drupalCoreInfo
    ->composerLock();
  if (isset($composerLockData['packages-dev'])) {
    foreach ($composerLockData['packages-dev'] as $package) {
      $composer['require'][$package['name']] = $package['version'];
    }
  }
  return $composer;
}