Code Duplication    Length = 18-21 lines in 2 locations

src/Module/RootModuleFileManagerImpl.php 2 locations

@@ 122-142 (lines=21) @@
119
    /**
120
     * {@inheritdoc}
121
     */
122
    public function addPluginClass($pluginClass)
123
    {
124
        if ($this->rootModuleFile->hasPluginClass($pluginClass)) {
125
            // Already installed locally
126
            return;
127
        }
128
129
        $this->validatePluginClass($pluginClass);
130
131
        $previousClasses = $this->rootModuleFile->getPluginClasses();
132
133
        $this->rootModuleFile->addPluginClass($pluginClass);
134
135
        try {
136
            $this->moduleFileStorage->saveRootModuleFile($this->rootModuleFile);
137
        } catch (Exception $e) {
138
            $this->rootModuleFile->setPluginClasses($previousClasses);
139
140
            throw $e;
141
        }
142
    }
143
144
    /**
145
     * {@inheritdoc}
@@ 321-338 (lines=18) @@
318
    /**
319
     * {@inheritdoc}
320
     */
321
    public function removeExtraKey($key)
322
    {
323
        if (!$this->rootModuleFile->hasExtraKey($key)) {
324
            return;
325
        }
326
327
        $previousValue = $this->rootModuleFile->getExtraKey($key);
328
329
        $this->rootModuleFile->removeExtraKey($key);
330
331
        try {
332
            $this->moduleFileStorage->saveRootModuleFile($this->rootModuleFile);
333
        } catch (Exception $e) {
334
            $this->rootModuleFile->setExtraKey($key, $previousValue);
335
336
            throw $e;
337
        }
338
    }
339
340
    /**
341
     * {@inheritdoc}