| @@ 122-142 (lines=21) @@ | ||
| 119 | /** |
|
| 120 | * {@inheritdoc} |
|
| 121 | */ |
|
| 122 | public function addPluginClass($pluginClass) |
|
| 123 | { |
|
| 124 | if ($this->rootPackageFile->hasPluginClass($pluginClass)) { |
|
| 125 | // Already installed locally |
|
| 126 | return; |
|
| 127 | } |
|
| 128 | ||
| 129 | $this->validatePluginClass($pluginClass); |
|
| 130 | ||
| 131 | $previousClasses = $this->rootPackageFile->getPluginClasses(); |
|
| 132 | ||
| 133 | $this->rootPackageFile->addPluginClass($pluginClass); |
|
| 134 | ||
| 135 | try { |
|
| 136 | $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); |
|
| 137 | } catch (Exception $e) { |
|
| 138 | $this->rootPackageFile->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->rootPackageFile->hasExtraKey($key)) { |
|
| 324 | return; |
|
| 325 | } |
|
| 326 | ||
| 327 | $previousValue = $this->rootPackageFile->getExtraKey($key); |
|
| 328 | ||
| 329 | $this->rootPackageFile->removeExtraKey($key); |
|
| 330 | ||
| 331 | try { |
|
| 332 | $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); |
|
| 333 | } catch (Exception $e) { |
|
| 334 | $this->rootPackageFile->setExtraKey($key, $previousValue); |
|
| 335 | ||
| 336 | throw $e; |
|
| 337 | } |
|
| 338 | } |
|
| 339 | ||
| 340 | /** |
|
| 341 | * {@inheritdoc} |
|