mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Merge remote-tracking branch 'hason/alias'
This commit is contained in:
commit
faa419cc0e
21 changed files with 373 additions and 125 deletions
|
@ -130,18 +130,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue