Code Duplication    Length = 18-18 lines in 3 locations

src/Module/RootModuleFileManagerImpl.php 3 locations

@@ 101-118 (lines=18) @@
98
    /**
99
     * {@inheritdoc}
100
     */
101
    public function setModuleName($moduleName)
102
    {
103
        if ($moduleName === $this->rootModuleFile->getModuleName()) {
104
            return;
105
        }
106
107
        $previousName = $this->rootModuleFile->getModuleName();
108
109
        $this->rootModuleFile->setModuleName($moduleName);
110
111
        try {
112
            $this->jsonStorage->saveRootModuleFile($this->rootModuleFile);
113
        } catch (Exception $e) {
114
            $this->rootModuleFile->setModuleName($previousName);
115
116
            throw $e;
117
        }
118
    }
119
120
    /**
121
     * {@inheritdoc}
@@ 372-389 (lines=18) @@
369
    /**
370
     * {@inheritdoc}
371
     */
372
    public function clearExtraKeys()
373
    {
374
        $previousValues = $this->rootModuleFile->getExtraKeys();
375
376
        if (!$previousValues) {
377
            return;
378
        }
379
380
        $this->rootModuleFile->clearExtraKeys();
381
382
        try {
383
            $this->jsonStorage->saveRootModuleFile($this->rootModuleFile);
384
        } catch (Exception $e) {
385
            $this->rootModuleFile->setExtraKeys($previousValues);
386
387
            throw $e;
388
        }
389
    }
390
391
    /**
392
     * {@inheritdoc}
@@ 452-469 (lines=18) @@
449
    /**
450
     * {@inheritdoc}
451
     */
452
    public function migrate($targetVersion)
453
    {
454
        $previousVersion = $this->rootModuleFile->getVersion();
455
456
        if ($previousVersion === $targetVersion) {
457
            return;
458
        }
459
460
        $this->rootModuleFile->setVersion($targetVersion);
461
462
        try {
463
            $this->jsonStorage->saveRootModuleFile($this->rootModuleFile);
464
        } catch (Exception $e) {
465
            $this->rootModuleFile->setVersion($previousVersion);
466
467
            throw $e;
468
        }
469
    }
470
471
    /**
472
     * {@inheritdoc}