/** * {@inheritdoc} */ public function removePluginClasses(Expression $expr) { $save = false; $previousClasses = $this->rootPackageFile->getPluginClasses(); foreach ($previousClasses as $pluginClass) { if ($expr->evaluate($pluginClass)) { $this->rootPackageFile->removePluginClass($pluginClass); $save = true; } } if (!$save) { return; } try { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); } catch (Exception $e) { $this->rootPackageFile->setPluginClasses($previousClasses); throw $e; } }
public function testClearPluginClasses() { $this->packageFile->setPluginClasses(array(self::PLUGIN_CLASS, self::OTHER_PLUGIN_CLASS)); $this->packageFile->clearPluginClasses(); $this->assertSame(array(), $this->packageFile->getPluginClasses()); }
private function populateRootConfig(RootPackageFile $packageFile, \stdClass $jsonData) { if (isset($jsonData->{'override-order'})) { $packageFile->setOverrideOrder((array) $jsonData->{'override-order'}); } if (isset($jsonData->plugins)) { $packageFile->setPluginClasses($jsonData->plugins); } if (isset($jsonData->config)) { $config = $packageFile->getConfig(); foreach ($this->objectsToArrays($jsonData->config) as $key => $value) { $config->set($key, $value); } } if (isset($jsonData->packages)) { foreach ($jsonData->packages as $packageName => $packageData) { $installInfo = new InstallInfo($packageName, $packageData->{'install-path'}); if (isset($packageData->installer)) { $installInfo->setInstallerName($packageData->installer); } if (isset($packageData->{'enabled-bindings'})) { foreach ($packageData->{'enabled-bindings'} as $uuid) { $installInfo->addEnabledBindingUuid(Uuid::fromString($uuid)); } } if (isset($packageData->{'disabled-bindings'})) { foreach ($packageData->{'disabled-bindings'} as $uuid) { $installInfo->addDisabledBindingUuid(Uuid::fromString($uuid)); } } $packageFile->addInstallInfo($installInfo); } } }