public function deactivatePackage($packageKey)
{
if (!$this->isPackageActive($packageKey)) {
return;
}
$package = $this->getPackage($packageKey);
if ($package->isProtected()) {
throw new Exception\ProtectedPackageKeyException('The package "' . $packageKey . '" is protected and cannot be deactivated.', 1308662891);
}
unset($this->activePackages[$packageKey]);
$composerName = $package->getComposerName();
$this->movePackageToDeactivatedPackages($package->getPackagePath());
$this->packageStatesConfiguration['packages'][$composerName]['state'] = self::PACKAGE_STATE_INACTIVE;
$this->packageStatesConfiguration['packages'][$composerName]['packagePath'] = $this->buildInactivePackageRelativePath($package->getPackagePath());
$this->registerPackageFromStateConfiguration($composerName, $this->packageStatesConfiguration['packages'][$composerName]);
$this->savePackageStates($this->packageStatesConfiguration);
}