/** * {@inheritdoc} */ public function addTarget(InstallTarget $target) { $this->assertTargetsLoaded(); if (!$this->installerManager->hasInstallerDescriptor($target->getInstallerName())) { throw NoSuchInstallerException::forInstallerName($target->getInstallerName()); } $previousTargets = $this->targets->toArray(); $previousData = $this->targetsData; $this->targets->add($target); $this->targetsData[$target->getName()] = $this->targetToData($target); try { $this->persistTargetsData(); } catch (Exception $e) { $this->targets->replace($previousTargets); $this->targetsData = $previousData; throw $e; } }
/** * {@inheritdoc} */ public function getInstallerDescriptor($name) { $this->assertInstallersLoaded(); if (!isset($this->installerDescriptors[$name])) { throw NoSuchInstallerException::forInstallerName($name); } return $this->installerDescriptors[$name]; }