Symfony\Installer\Manager\ComposerManager::getComposerContentHash PHP Метод

getComposerContentHash() приватный Метод

Returns the md5 hash of the sorted content of the composer file.
См. также: https://github.com/composer/composer/blob/master/src/Composer/Package/Locker.php (getContentHash() method)
private getComposerContentHash ( string $composerJsonFileContents ) : string
$composerJsonFileContents string The contents of the composer.json file.
Результат string The hash of the composer file content.
    private function getComposerContentHash($composerJsonFileContents)
    {
        $composerConfig = json_decode($composerJsonFileContents, true);
        $relevantKeys = array('name', 'version', 'require', 'require-dev', 'conflict', 'replace', 'provide', 'minimum-stability', 'prefer-stable', 'repositories', 'extra');
        $relevantComposerConfig = array();
        foreach (array_intersect($relevantKeys, array_keys($composerConfig)) as $key) {
            $relevantComposerConfig[$key] = $composerConfig[$key];
        }
        if (isset($composerConfig['config']['platform'])) {
            $relevantComposerConfig['config']['platform'] = $composerConfig['config']['platform'];
        }
        ksort($relevantComposerConfig);
        return md5(json_encode($relevantComposerConfig));
    }