/** * {@inheritdoc} */ public function addServer(Server $server) { $this->assertServersLoaded(); if (!$this->installerManager->hasInstallerDescriptor($server->getInstallerName())) { throw NoSuchInstallerException::forInstallerName($server->getInstallerName()); } $previousServers = $this->servers->toArray(); $previousData = $this->serversData; $this->servers->add($server); $this->serversData[$server->getName()] = $this->serverToData($server); try { $this->persistServersData(); } catch (Exception $e) { $this->servers->replace($previousServers); $this->serversData = $previousData; throw $e; } }
/** * {@inheritdoc} */ public function getInstallerDescriptor($name) { $this->assertInstallersLoaded(); if (!isset($this->installerDescriptors[$name])) { throw NoSuchInstallerException::forInstallerName($name); } return $this->installerDescriptors[$name]; }