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

        return $rootPackage;
    }