/** * {@inheritdoc} */ public function rollback() { $rootPackageName = $this->rootPackage->getName(); $rootPackageFile = $this->rootPackage->getPackageFile(); foreach ($this->overriddenPackages as $packageName) { $rootPackageFile->removeOverriddenPackage($packageName); } foreach ($this->addedEdgesFrom as $packageName) { $this->overrideGraph->removeEdge($packageName, $rootPackageName); } }
/** * Returns all installed packages. * * The installed packages are all packages that are not the root package. * * @return Package[] The installed packages indexed by their names. */ public function getInstalledPackages() { $packages = $this->packages; if ($this->rootPackage) { unset($packages[$this->rootPackage->getName()]); } return $packages; }
/** * {@inheritdoc} */ public function getRootInstallerDescriptor($name) { $this->assertInstallersLoaded(); if (!isset($this->rootInstallerDescriptors[$name])) { throw NoSuchInstallerException::forInstallerNameAndPackageName($name, $this->rootPackage->getName()); } return $this->rootInstallerDescriptors[$name]; }
/** * {@inheritdoc} */ public function hasRootBindings(Expression $expr = null) { $expr2 = Expr::same($this->rootPackage->getName(), BindingDescriptor::CONTAINING_PACKAGE); if ($expr) { $expr2 = $expr2->andX($expr); } return $this->hasBindings($expr2); }
public function testPackageNameSetToDefaultIfEmpty() { $packageFile = new RootPackageFile(); $package = new RootPackage($packageFile, '/path'); $this->assertSame('__root__', $package->getName()); }
/** * {@inheritdoc} */ public function getRootBindingDescriptor(Uuid $uuid) { $binding = $this->getBindingDescriptor($uuid); if (!$binding->getContainingPackage() instanceof RootPackage) { throw NoSuchBindingException::forUuidAndPackage($uuid, $this->rootPackage->getName()); } return $binding; }
/** * {@inheritdoc} */ public function hasRootPathMapping($repositoryPath) { return $this->hasPathMapping($repositoryPath, $this->rootPackage->getName()); }
private function renameRootPackage(RootPackage $package, $newName) { $packageFile = $package->getPackageFile(); $previousName = $packageFile->getPackageName(); $packageFile->setPackageName($newName); try { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); } catch (Exception $e) { $packageFile->setPackageName($previousName); throw $e; } $this->packages->remove($package->getName()); $this->packages->add(new RootPackage($packageFile, $package->getInstallPath())); }