function DrupalCoreComposer::packageLockInfo

Same name in other branches
  1. 8.9.x composer/Generator/Util/DrupalCoreComposer.php \Drupal\Composer\Generator\Util\DrupalCoreComposer::packageLockInfo()
  2. 10 composer/Generator/Util/DrupalCoreComposer.php \Drupal\Composer\Generator\Util\DrupalCoreComposer::packageLockInfo()
  3. 11.x 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 [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.