/** * Adds a new package to the repository * * @param PackageInterface $package */ public function addPackage(PackageInterface $package) { if (null === $this->packages) { $this->initialize(); } $package->setRepository($this); $this->packages[] = $package; }
/** * Adds a new package to the repository * * @param PackageInterface $package */ public function addPackage(PackageInterface $package) { if (null === $this->packages) { $this->initialize(); } $package->setRepository($this); $this->packages[] = $package; // create alias package on the fly if needed (installed repos manage aliases themselves) if ($package->getAlias() && !$this instanceof InstalledRepositoryInterface) { $this->addPackage($this->createAliasPackage($package)); } }
public function addPackage(PackageInterface $package) { if (null === $this->packages) { $this->initialize(); } $package->setRepository($this); $this->packages[] = $package; if ($package instanceof AliasPackage) { $aliasedPackage = $package->getAliasOf(); if (null === $aliasedPackage->getRepository()) { $this->addPackage($aliasedPackage); } } }
/** * Adds a new package to the repository * * @param PackageInterface $package */ public function addPackage(PackageInterface $package) { if (null === $this->packages) { $this->initialize(); } $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); } } }
/** * {@inheritdoc} */ public function setRepository(RepositoryInterface $repository) { $this->package->setRepository($repository); }