1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-11 01:22:54 +00:00

Added support for the alias of an aliased package

This commit is contained in:
Martin Hasoň 2013-04-01 08:10:15 +02:00
parent c39e958a6f
commit 753a8345cb
14 changed files with 120 additions and 119 deletions

View file

@ -124,18 +124,17 @@ class ArrayRepository implements RepositoryInterface
$package->setRepository($this);
$this->packages[] = $package;
// create alias package on the fly if needed
if ($package->getAlias()) {
$alias = $this->createAliasPackage($package);
if (!$this->hasPackage($alias)) {
$this->addPackage($alias);
if ($package instanceof AliasPackage) {
$aliasedPackage = $package->getAliasOf();
if (null === $aliasedPackage->getRepository()) {
$this->addPackage($aliasedPackage);
}
}
}
protected function createAliasPackage(PackageInterface $package, $alias = null, $prettyAlias = null)
protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
{
return new AliasPackage($package, $alias ?: $package->getAlias(), $prettyAlias ?: $package->getPrettyAlias());
return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
}
/**