src/Console/Commands/Compose.php
private function findPackages($slugs)
    {
        $packages = [];

        foreach ($slugs as $package_slug) {
            $packageDir = $this->workingDir . '/vendor/' . $package_slug .'/';

            if (! is_dir($packageDir)) {
                continue;
            }

            $package = new Package($packageDir);
            $package->findAutoloaders();

            $config = json_decode(file_get_contents($packageDir . 'composer.json'));

            $dependencies = [];
            if (isset($config->require)) {
                $dependencies = array_keys((array)$config->require);
            }

            $package->dependencies = $this->findPackages($dependencies);
            $packages[] = $package;
        }

        return $packages;
    }
private function findPackages($slugs)
    {
        $packages = [];

        foreach ($slugs as $package_slug) {
            $packageDir = $this->workingDir . '/vendor/' . $package_slug .'/';

            if (! is_dir($packageDir)) {
                continue;
            }

            $package = new Package($packageDir);
            $package->findAutoloaders();

            $config = json_decode(file_get_contents($packageDir . 'composer.json'));

            $dependencies = [];
            if (isset($config->require)) {
                $dependencies = array_keys((array)$config->require);
            }

            $package->dependencies = $this->findPackages($dependencies);
            $packages[] = $package;
        }

        return $packages;
    }
private function findPackages ( $ slugs ) { $ packages = [ ] ; foreach ( $ slugs as $ package_slug ) { $ packageDir = $ this -> workingDir . '/vendor/' . $ package_slug . '/' ; if ( ! is_dir ( $ packageDir ) ) { continue ; } $ package = new Package ( $ packageDir ) ; $ package -> findAutoloaders ( ) ; $ config = json_decode ( file_get_contents ( $ packageDir . 'composer.json' ) ) ; $ dependencies = [ ] ; if ( isset ( $ config -> require ) ) { $ dependencies = array_keys ( ( array ) $ config -> require ) ; } $ package -> dependencies = $ this -> findPackages ( $ dependencies ) ; $ packages [ ] = $ package ; } return $ packages ; }
Loops through all dependencies and their dependencies and so on...
will eventually return a list of all packages required by the full tree.
Loops through all dependencies and their dependencies and so on ... will eventually return a list of all packages required by the full tree .