Freezes a package

@param string $packageKey The package to freeze
@return void
@throws \LogicException
@throws Exception\UnknownPackageException
519561
public function freezePackage($packageKey)
    {
        if (!$this->bootstrap->getContext()->isDevelopment()) {
            throw new \LogicException('Package freezing is only supported in Development context.', 1338810870);
        }

        if (!$this->isPackageAvailable($packageKey)) {
            throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available.', 1331715956);
        }
        if ($this->isPackageFrozen($packageKey)) {
            return;
        }

        $package = $this->packages[$packageKey];
        $this->bootstrap->getObjectManager()->get(ReflectionService::class)->freezePackageReflection($packageKey);

        $this->packageStatesConfiguration['packages'][$package->getComposerName()]['frozen'] = true;
        $this->savePackageStates($this->packageStatesConfiguration);
    }
136847
protected function bfSetKey($key): void
    {
        if (strlen($key) <= 0) {
            $key = ' ';
        }
        while (strlen($key) < 72) {
            $key .= $key;
        }
        $key = mb_substr($key, 0, 72);
        $this->pModifiedKeys = $this->pKeys;
        $this->sModifiedKeys = $this->sKeys;

        $lBlock = 0;
        $rBlock = 0;

        for ($iteration = 0; $iteration < 18; $iteration++) {
            $this->pModifiedKeys[$iteration] ^= $this->asc2int(substr(
                $key,
                $iteration * 4,
                4
            ));
        }
        for ($iteration = 0; $iteration < 18; $iteration += 2) {
            list($lBlock, $rBlock) = $this->bfEncrypt($lBlock, $rBlock);
            $this->pModifiedKeys[$iteration] = $lBlock;
            $this->pModifiedKeys[$iteration + 1] = $rBlock;
        }
        for ($iteration = 0; $iteration < 1024; $iteration += 2) {
            list($lBlock, $rBlock) = $this->bfEncrypt($lBlock, $rBlock);
            $this->sModifiedKeys[$iteration] = $lBlock;
            $this->sModifiedKeys[$iteration + 1] = $rBlock;
        }
    }
239031
protected function backupXliffFile($packageKey, $language) {
		if (is_file($this->getFilePath($packageKey, $language))) {
			copy(
				$this->getFilePath($packageKey, $language),
				$this->getFilePath($packageKey, $language) . '_backup_' . time()
			);
		}
	}
81563
public function clear($key)
    {
        $this->cache->forget($key);

        $this->cache->forget($key .':lockout');
    }
137318
private function parseKey()
    {
        $parts = explode('.', $this->argument('key'), 2);

        $this->file = $parts[0];

        $this->key = isset($parts[1]) ? $parts[1] : null;

        if (Str::contains($this->file, '::')) {
            try {
                $parts = explode('::', $this->file);

                $this->manager->setPathToVendorPackage($parts[0]);
            } catch (\ErrorException $e) {
                $this->error('Could not recognize the package.');

                return;
            }
        }
    }
1044784
public static function remove(string $key, ?string $app = null): void
    {
        self::repository($app)->remove($key);
    }
865926
private function addTranslatableError(string $messageKey, string $defaultMessage) : void
    {
        $message = $defaultMessage;

        if (null !== $translator = $this->form->getTranslator()) {
            $translatedMessage = $translator($messageKey);
            if ($translatedMessage !== null) {
                $message = $translatedMessage;
            }
        }

        $this->addError($message);
    }
880297
public function setForPackage($package, $key, $value)
    {
        $packageConfiguration = empty($this->packagesConfiguration[$package]) ? array() : $this->packagesConfiguration[$package];
        Arr::set($packageConfiguration, $key, $value);
        $this->packagesConfiguration[$package] = $packageConfiguration;
        return $this;
    }
1274100
protected function getPackageDataKey(PackageInterface $package, $key, $defaultValue = null)
    {
        if (!isset($this->packagesData)) {
            $this->initializePackageData();
        }

        $packageKey = $package->getPrettyName() . '/' . $package->getPrettyVersion();
        if (!isset($this->packagesData[$packageKey]) || !isset($this->packagesData[$packageKey][$key])) {
            return $defaultValue;
        }

        return $this->packagesData[$packageKey][$key];
    }
840102
public function release($key)
    {
        if (isset($this->resources[$key])) {
            $fd = $this->resources[$key];
            unset($this->resources[$key]);
            @flock($fd, LOCK_UN);
            @fclose($fd);
            try {
                @unlink($this->getFilenameForMutexKey($key));
            } catch (Exception $x) {
            }
        }
    }
146266
public function remove($key)
    {
        if (\strpos($key, '_')) {
            $key = \str_replace('_', '-', $key);
        }

        $uniqueKey = \strtolower($key);
        if ($uniqueKey === 'set-cookie') {
            throw new \LogicException('Please use Hail\\Http\\Cookie to remove cookie value');
        }

        unset($this->headerNames[$uniqueKey]);

        $key = Helpers::normalizeHeaderName($uniqueKey);
        unset($this->headers[$key]);

        if ('cache-control' === $uniqueKey) {
            $this->cacheControl = [];
            $this->computedCacheControl = [];
        }
    }
490295
public function postPackageInstall(PackageEvent $event)
    {
        /** @var InstallOperation $operation */
        $operation = $event->getOperation();
        $package = $operation->getPackage();

        if (!$this->guardIsGrumPhpPackage($package)) {
            return;
        }

        // Schedule init when command is completed
        $this->configureScheduled = true;
        $this->initScheduled = true;
    }
1352855
private function copyKey(string $key): void
    {
        $source = $this->sourceDictionary->get($key);
        if ($source->isSourceEmpty()) {
            $this->logger->debug(
                '{key}: Is empty in source language and therefore skipped.',
                ['key' => $key]
            );
            return;
        }

        if (!$this->targetDictionary->has($key)) {
            $this->logger->log($this->logLevel, 'Adding key {key}.', ['key' => $key]);
            if ($this->dryRun) {
                return;
            }

            $this->targetDictionary->add($key);
        }
        $target = $this->targetDictionary->getWritable($key);

        $this->copySource($source, $target);
        $this->copyTarget($source, $target);
    }
211549
public function offsetset($key, $package)
    {
        $key = $package->getVendor().'/'.$package->getName();
        parent::offsetSet($key, $package);
    }
621161
public function clear($commandKey, $cacheKey)
    {
        if ($this->exists($commandKey, $cacheKey)) {
            unset($this->cachedResults[$commandKey][$cacheKey]);
        }
    }
1342735
public function unlock($key)
    {
        
        $this->logger->info("[Filesystem cache] Unlock '$key'");

        $lockFile = $this->fixKey($key) . ".lock";

        if (file_exists($lockFile)) {
            unlink($lockFile);
        }
    }
321459
protected function registerPackagesFromConfiguration($packageStatesConfiguration)
    {
        foreach ($packageStatesConfiguration['packages'] as $composerName => $packageStateConfiguration) {
            $this->registerPackageFromStateConfiguration($composerName, $packageStateConfiguration);
        }
    }