protected function getComposerLockInstalled($rootPackageRequirements)
    {
        $rawInstalled = [[]];

        // Find composer.lock file
        $finder = new Finder(['lock'], $this->config->get('exclude'));
        $files = $finder->fetch($this->config->get('files'));

        // List all composer.lock found in the project.
        foreach ($files as $filename) {
            if (false === \strpos($filename, 'composer.lock')) {
                continue;
            }
            $composerLockJson = (object)\json_decode(\file_get_contents($filename));

            if (!isset($composerLockJson->packages)) {
                continue;
            }

            $installed = [];
            foreach ($composerLockJson->packages as $package) {
                if (!\in_array($package->name, $rootPackageRequirements, true)) {
                    continue;
                }

                $installed[$package->name] = \preg_replace('#[^.\d]#', '', $package->version);
            }

            $rawInstalled[] = $installed;
        }

        return \call_user_func_array('array_merge', $rawInstalled);
    }
protected function getComposerLockInstalled($rootPackageRequirements)
    {
        $rawInstalled = [[]];

        // Find composer.lock file
        $finder = new Finder(['lock'], $this->config->get('exclude'));
        $files = $finder->fetch($this->config->get('files'));

        // List all composer.lock found in the project.
        foreach ($files as $filename) {
            if (false === \strpos($filename, 'composer.lock')) {
                continue;
            }
            $composerLockJson = (object)\json_decode(\file_get_contents($filename));

            if (!isset($composerLockJson->packages)) {
                continue;
            }

            $installed = [];
            foreach ($composerLockJson->packages as $package) {
                if (!\in_array($package->name, $rootPackageRequirements, true)) {
                    continue;
                }

                $installed[$package->name] = \preg_replace('#[^.\d]#', '', $package->version);
            }

            $rawInstalled[] = $installed;
        }

        return \call_user_func_array('array_merge', $rawInstalled);
    }
protected function getComposerLockInstalled ( $ rootPackageRequirements ) { $ rawInstalled = [ [ ] ] ; // Find composer.lock file $ finder = new Finder ( [ 'lock' ] , $ this -> config -> get ( 'exclude' ) ) ; $ files = $ finder -> fetch ( $ this -> config -> get ( 'files' ) ) ; // List all composer.lock found in the project. foreach ( $ files as $ filename ) { if ( false === \ strpos ( $ filename , 'composer.lock' ) ) { continue ; } $ composerLockJson = ( object ) \ json_decode ( \ file_get_contents ( $ filename ) ) ; if ( ! isset ( $ composerLockJson -> packages ) ) { continue ; } $ installed = [ ] ; foreach ( $ composerLockJson -> packages as $ package ) { if ( ! \ in_array ( $ package -> name , $ rootPackageRequirements , true ) ) { continue ; } $ installed [ $ package -> name ] = \ preg_replace ( '#[^.\d]#' , '' , $ package -> version ) ; } $ rawInstalled [ ] = $ installed ; } return \ call_user_func_array ( 'array_merge' , $ rawInstalled ) ; }
Returns the installed packages from the composer.lock file.
@param array $rootPackageRequirements List of requirements to match installed packages only with requirements.
@return array
Returns the installed packages from the composer . lock file .