src/Installer/PluginInstaller.php
protected static function getRootPackage(\Composer\Composer $composer)
    {
        $rootPackage = $composer->getPackage();
        if ($rootPackage) {
            while ($rootPackage instanceof \Composer\Package\AliasPackage) {
                $rootPackage = $rootPackage->getAliasOf();
            }
        }

        return $rootPackage;
    }
protected static function getRootPackage(\Composer\Composer $composer)
    {
        $rootPackage = $composer->getPackage();
        if ($rootPackage) {
            while ($rootPackage instanceof \Composer\Package\AliasPackage) {
                $rootPackage = $rootPackage->getAliasOf();
            }
        }

        return $rootPackage;
    }
Returns the root package of a composer instance

@param  \Composer\Composer $composer
@return \Composer\Package\PackageInterface