You are here

public function DrupalCoreComposer::packageLockInfo in Drupal 8

Same name and namespace in other branches
  1. 9 composer/Generator/Util/DrupalCoreComposer.php \Drupal\Composer\Generator\Util\DrupalCoreComposer::packageLockInfo()

Look up the info for one package in the composer.lock file.

Parameters

string $packageName: Name of package to find, e.g. 'behat/mink-selenium2-driver'.

bool $dev: TRUE: consider only 'packages-dev'. Default: consider only 'packages'

Return value

array Package info from composer.lock.

File

composer/Generator/Util/DrupalCoreComposer.php, line 100

Class

DrupalCoreComposer
Utilities for accessing composer.json data from drupal/drupal and drupal/core.

Namespace

Drupal\Composer\Generator\Util

Code

public function packageLockInfo($packageName, $dev = FALSE) {
  $packagesSection = $dev ? 'packages-dev' : 'packages';
  foreach ($this->composerLock[$packagesSection] as $info) {
    if ($info['name'] == $packageName) {
      return $info;
    }
  }
  return [];
}