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));
    }
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));
    }
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 ) ) ; }
Returns the md5 hash of the sorted content of the composer file.

@see https://github.com/composer/composer/blob/master/src/Composer/Package/Locker.php (getContentHash() method)

@param string $composerJsonFileContents The contents of the composer.json file.

@return string The hash of the composer file content.
Returns the md5 hash of the sorted content of the composer file .