Show packages.

@param string $target
@param string $package
@param string $version
@param bool   $root

@return array
488883
public function showPackage($target, $package = '', $version = '', $root = false)
    {
        return $this->app['extend.action']['show']->execute($target, $package, $version, $root);
    }
903143
function(callback) {
    var packageToVersions = this.packageToVersions;
    var count = Package.versionCount(packageToVersions);
    if (count === 0) {
      return callback && callback();
    }

    // For each package version, check shasum and copy to server root.
    var packages = Object.keys(packageToVersions);
    async.parallel(
      packages
        .map(function(package) {
          var versions = Object.keys(packageToVersions[package]);
          return versions.map(function(version) {
            return this.verifyPackageVersion.bind(this, package, version);
          }.bind(this));
        }.bind(this))
        .reduce(function(prev, curr) {
          return prev.concat(curr);
        }),
      function(err) {
        if (err) {
          return callback && callback(err);
        }

        ncp(this.tempdir, this.root, callback);
      }.bind(this)
    );
  }
9182
private function getBranchAliases(ApiPackage\Version $version)
    {
        $extra = $version->getExtra();
        if (null !== $extra
            && isset($extra["branch-alias"])
            && is_array($extra["branch-alias"])
        ) {
            return $extra["branch-alias"];
        }

        return null;
    }
784006
private function scanNamespaceForPackages(NamespaceInterface $root, PackageInterface $parent = null): Generator
    {
        foreach ($root->iterateNamespaces() as $namespace) {
            yield from $this->loadPackage($namespace, $parent);
        }
    }
1284102
protected function mergeSuggests(RootPackageInterface $root)
    {
        if ( ! empty($suggests = $this->getPackage()->getSuggests())) {
            static::unwrapIfNeeded($root, 'setSuggests')
                ->setSuggests(array_merge($root->getSuggests(), $suggests));
        }
    }
1054450
public function getPackages()
    {
        $this->start();
        try {
            $this->getUserControl()->checkRateLimit();
            $this->getUserControl()->checkGenericAccess(__FUNCTION__);
            $repo = $this->app->make(PackageRepository::class);
            $packages = $repo->createQueryBuilder('p')
                ->select('p.handle, p.name')
                ->getQuery()->getArrayResult();
            $result = $this->buildJsonResponse($packages);
        } catch (Exception $x) {
            $result = $this->buildErrorResponse($x);
        } catch (Throwable $x) {
            $result = $this->buildErrorResponse($x);
        }

        return $this->finish($result);
    }
1315787
private function getMappedPackageList(array $packages): array
    {
        $groupedPackages = $this->groupPackagesByName($packages);

        $mappedPackages = [];
        foreach ($groupedPackages as $name => $packages) {
            $highest = $this->getHighestVersion($packages);

            $mappedPackages[$name] = [
                'highest' => $highest,
                'abandoned' => $highest instanceof CompletePackageInterface ? $highest->isAbandoned() : false,
                'replacement' => $highest instanceof CompletePackageInterface ? $highest->getReplacementPackage() : null,
                'versions' => $this->getDescSortedVersions($packages),
            ];
        }

        return $mappedPackages;
    }
1235836
private function loadPackageRuleSet(Package $package)
    {
        $ruleSet = new RuleSet();
        $key = $package->generatePackageKey();

        if ($this->cache->has($key)) {
            $ruleSet = $this->cache->getCachedRuleSet($key);
        } elseif (is_dir($path = $package->getPackagePath(self::PACKAGE_PATH))) {
            $ruleSet = $this->traverser->traverse($path);
            $this->cache->cacheRuleSet($key, $ruleSet);
        } else {
            // there is no vendor package in the given path
        }

        return $ruleSet;
    }
1130722
protected function readVersionFromLocation(string $location, string $package) : ?string
    {
        // Get the installed packages
        $installed = $this->getInstalledPackages($location);
        if(empty($installed)){
            return null;
        }

        // Search for package
        foreach ($installed as $installedPackage){
            $version = $this->readFromSource($installedPackage, $package);
            if(isset($version)){
                return $version;
            }
        }

        // Nothing found in this package
        return null;
    }
315747
public function actionAllVersion()
	{
		Output::line('Getting package info...');
		$collection = \App::$domain->vendor->info->allVersion();
		if(!empty($collection)) {
			$flatCollection = ArrayHelper::map($collection, 'package', 'version');
			Output::line();
			Output::arr($flatCollection, 'Repository version list');
		} else {
			Output::block('Empty list!', 'Message');
		}
	}
214083
protected function mergeDevRequires(RootPackageInterface $root, PluginState $state)
    {
        if ( ! empty($requires = $this->getPackage()->getDevRequires())) {
            $this->mergeStabilityFlags($root, $requires);

            $duplicateLinks = [];
            $requires       = $this->replaceSelfVersionDependencies(
                'require-dev', $requires, $root
            );

            $root->setDevRequires($this->mergeLinks(
                $root->getDevRequires(), $requires, $state, $duplicateLinks
            ));

            $state->addDuplicateLinks('require-dev', $duplicateLinks);
        }
    }
643694
protected function mergeSuggests(RootPackageInterface $root)
    {
        $suggests = $this->package->getSuggests();
        if (!empty($suggests)) {
            $unwrapped = self::unwrapIfNeeded($root, 'setSuggests');
            $unwrapped->setSuggests(array_merge(
                $root->getSuggests(),
                $suggests
            ));
        }
    }
696652
protected function mergeRequires(
        $type,
        RootPackageInterface $root,
        PluginState $state
    ) {
        $linkType = BasePackage::$supportedLinkTypes[$type];
        $getter = 'get' . ucfirst($linkType['method']);
        $setter = 'set' . ucfirst($linkType['method']);

        $requires = $this->package->{$getter}();
        if (empty($requires)) {
            return;
        }

        $this->mergeStabilityFlags($root, $requires);

        $requires = $this->replaceSelfVersionDependencies(
            $type,
            $requires,
            $root
        );

        $root->{$setter}($this->mergeOrDefer(
            $type,
            $root->{$getter}(),
            $requires,
            $state
        ));
    }
1023190
public function update($package = null, $version = null, $dryRun = false)
    {
        if ($dryRun) {
            $this->setDryRun(true);
        }

        $package = !empty($version) ? $package . ':' . $version : $package;

        return $this->runCommand(self::UPDATE, $package, self::ROOT_REQS . self::DEFAULT_ARGS);
    }
259670
protected function parsePackageVersion($package)
    {
        $parts = explode(':', $package, 2);
        $parts[1] = isset($parts[1]) ? trim($parts[1]) : '*';
        if ($parts[1] !== '') {
            $name = $parts[0];
            $version = $parts[1];
        } else {
            $name = $package;
            $version = '*';
        }

        return array($name, $version);
    }
1209982
public function findPackages($name, $version)
    {
        $packages = array();

        foreach ($this->repositories as $repository) {
            $packages = array_merge($packages, $repository->findPackages($name, $version));
        }

        return $packages;
    }
580077
public function findAll(): array
    {
        $rootPackage = $this->composer->getPackage();
        $dependencies = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages();

        $packagesWithDuplicates = array_merge([$rootPackage], $dependencies);

        return $this->removeDuplicates($packagesWithDuplicates);
    }