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