/**
  * @param \Composer\Package\Link[] $packageLinks
  * @param bool $ignoreRequiredVersion
  * @param bool $exactAsTilda
  * @return \Composer\Package\PackageInterface[]
  */
 private function getLatestPackages(array $packageLinks, $ignoreRequiredVersion = FALSE, $exactAsTilda = FALSE)
 {
     $packageIds = $this->policy->selectPreferredPackages($this->pool, [], $this->getLiterals($packageLinks, $ignoreRequiredVersion, $exactAsTilda));
     $packages = [];
     foreach ($packageIds as $packageId) {
         $package = $this->pool->packageById($packageId);
         $packages[$package->getName()] = $package;
     }
     return $packages;
 }
Exemple #2
0
 public function testPackageById()
 {
     $pool = new Pool();
     $repository = new ArrayRepository();
     $package = $this->getPackage('foo', '1');
     $repository->addPackage($package);
     $pool->addRepository($repository);
     $this->assertSame($package, $pool->packageById(1));
 }