@@ 169-192 (lines=24) @@ | ||
166 | /** |
|
167 | * {@inheritdoc} |
|
168 | */ |
|
169 | public function removePluginClasses(Expression $expr) |
|
170 | { |
|
171 | $save = false; |
|
172 | $previousClasses = $this->rootPackageFile->getPluginClasses(); |
|
173 | ||
174 | foreach ($previousClasses as $pluginClass) { |
|
175 | if ($expr->evaluate($pluginClass)) { |
|
176 | $this->rootPackageFile->removePluginClass($pluginClass); |
|
177 | $save = true; |
|
178 | } |
|
179 | } |
|
180 | ||
181 | if (!$save) { |
|
182 | return; |
|
183 | } |
|
184 | ||
185 | try { |
|
186 | $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); |
|
187 | } catch (Exception $e) { |
|
188 | $this->rootPackageFile->setPluginClasses($previousClasses); |
|
189 | ||
190 | throw $e; |
|
191 | } |
|
192 | } |
|
193 | ||
194 | /** |
|
195 | * {@inheritdoc} |
|
@@ 343-366 (lines=24) @@ | ||
340 | /** |
|
341 | * {@inheritdoc} |
|
342 | */ |
|
343 | public function removeExtraKeys(Expression $expr) |
|
344 | { |
|
345 | $previousValues = $this->rootPackageFile->getExtraKeys(); |
|
346 | $save = false; |
|
347 | ||
348 | foreach ($this->rootPackageFile->getExtraKeys() as $key => $value) { |
|
349 | if ($expr->evaluate($key)) { |
|
350 | $this->rootPackageFile->removeExtraKey($key); |
|
351 | $save = true; |
|
352 | } |
|
353 | } |
|
354 | ||
355 | if (!$save) { |
|
356 | return; |
|
357 | } |
|
358 | ||
359 | try { |
|
360 | $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); |
|
361 | } catch (Exception $e) { |
|
362 | $this->rootPackageFile->setExtraKeys($previousValues); |
|
363 | ||
364 | throw $e; |
|
365 | } |
|
366 | } |
|
367 | ||
368 | /** |
|
369 | * {@inheritdoc} |