You are here

public function StabilityFlags::extractAll in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php \Wikimedia\Composer\Merge\StabilityFlags::extractAll()

Extract and merge stability flags from the given collection of requires with another collection of stability flags.

Parameters

array $requires New package name => link mappings:

Return value

array Unified package name => stability mappings

File

vendor/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php, line 75

Class

StabilityFlags
Adapted from Composer's RootPackageLoader::extractStabilityFlags @author Bryan Davis <bd808@bd808.com>

Namespace

Wikimedia\Composer\Merge

Code

public function extractAll(array $requires) {
  $flags = array();
  foreach ($requires as $name => $link) {
    $name = strtolower($name);
    $version = $link
      ->getPrettyConstraint();
    $stability = $this
      ->getExplicitStability($version);
    if ($stability === null) {
      $stability = $this
        ->getParsedStability($version);
    }
    $flags[$name] = max($stability, $this
      ->getCurrentStability($name));
  }

  // Filter out null stability values
  return array_filter($flags, function ($v) {
    return $v !== null;
  });
}