Puli\Manager\Module\ModuleManagerImpl::renameNonRootModule PHP Method

renameNonRootModule() private method

private renameNonRootModule ( Puli\Manager\Api\Module\Module $module, $newName )
$module Puli\Manager\Api\Module\Module
    private function renameNonRootModule(Module $module, $newName)
    {
        $previousInstallInfo = $module->getInstallInfo();
        $installInfo = new InstallInfo($newName, $previousInstallInfo->getInstallPath());
        $installInfo->setInstallerName($previousInstallInfo->getInstallerName());
        foreach ($previousInstallInfo->getDisabledBindingUuids() as $uuid) {
            $installInfo->addDisabledBindingUuid($uuid);
        }
        $this->rootModuleFile->removeInstallInfo($module->getName());
        $this->rootModuleFile->addInstallInfo($installInfo);
        try {
            $this->jsonStorage->saveRootModuleFile($this->rootModuleFile);
        } catch (Exception $e) {
            $this->rootModuleFile->removeInstallInfo($newName);
            $this->rootModuleFile->addInstallInfo($previousInstallInfo);
            throw $e;
        }
        $this->modules->remove($module->getName());
        $this->modules->add(new Module($module->getModuleFile(), $module->getInstallPath(), $installInfo, $module->getLoadErrors()));
    }