src/ComposerRequireChecker/FileLocator/LocateComposerPackageDirectDependenciesSourceFiles.php
private function getInstalledPackages(string $vendorDir): array
    {
        try {
            $installedData = (new JsonLoader($vendorDir . '/composer/installed.json'))->getData();
        } catch (NotReadableException $e) {
            $message = 'The composer dependencies have not been installed, run composer install/update first';
            throw new DependenciesNotInstalledException($message);
        }

        $installedPackages = [];

        $packages = $installedData['packages'] ?? $installedData;
        foreach ($packages as $vendorJson) {
            $vendorName = $vendorJson['name'];
            $installedPackages[$vendorName] = $vendorJson;
        }

        return $installedPackages;
    }
private function getInstalledPackages(string $vendorDir): array
    {
        try {
            $installedData = (new JsonLoader($vendorDir . '/composer/installed.json'))->getData();
        } catch (NotReadableException $e) {
            $message = 'The composer dependencies have not been installed, run composer install/update first';
            throw new DependenciesNotInstalledException($message);
        }

        $installedPackages = [];

        $packages = $installedData['packages'] ?? $installedData;
        foreach ($packages as $vendorJson) {
            $vendorName = $vendorJson['name'];
            $installedPackages[$vendorName] = $vendorJson;
        }

        return $installedPackages;
    }
private function getInstalledPackages ( string $ vendorDir ) : array { try { $ installedData = ( new JsonLoader ( $ vendorDir . '/composer/installed.json' ) ) -> getData ( ) ; } catch ( NotReadableException $ e ) { $ message = 'The composer dependencies have not been installed, run composer install/update first' ; throw new DependenciesNotInstalledException ( $ message ) ; } $ installedPackages = [ ] ; $ packages = $ installedData [ 'packages' ] ?? $ installedData ; foreach ( $ packages as $ vendorJson ) { $ vendorName = $ vendorJson [ 'name' ] ; $ installedPackages [ $ vendorName ] = $ vendorJson ; } return $ installedPackages ; }
Lookup each vendor package's composer.json info from installed.json

@param string $vendorDir

@return array Keys are the package name and value is the composer.json as an array
@throws DependenciesNotInstalledException When composer install/update has not been run
Lookup each vendor package s composer . json info from installed . json