@param array $only_packages

@return array
347797
private function userInputPackages($only_packages)
    {
        $found = ['total' => 0];
        $ignore = [];

        if (!\count($only_packages)) {
            $this->output->writeln('');
        } else {
            foreach ($only_packages as $only_package) {
                $find = $this->gpm->findPackage($only_package);

                if (!$find || (!$this->overwrite && !$this->gpm->isUpdatable($find->slug))) {
                    $name = $find->slug ?? $only_package;
                    $ignore[$name] = $name;
                } else {
                    $found[$find->slug] = $find;
                    $found['total']++;
                }
            }

            if ($found['total']) {
                $list = $found;
                unset($list['total']);
                $list = array_keys($list);

                if ($found['total'] !== $this->data['total']) {
                    $this->output->write(", only <magenta>{$found['total']}</magenta> will be updated");
                }

                $this->output->writeln('');
                $this->output->writeln('Limiting updates for only <cyan>' . implode('</cyan>, <cyan>',
                        $list) . '</cyan>');
            }

            if (\count($ignore)) {
                $this->output->writeln('');
                $this->output->writeln('Packages not found or not requiring updates: <red>' . implode('</red>, <red>',
                        $ignore) . '</red>');

            }
        }

        return $found;
    }
276868
public function package()
    {
        return [
            'type' => $this->type,
            'id' => $this->id,
            'descriptor' => $this->descriptor,
            'subdescriptor' => $this->subdescriptor,
            'hasChildren' => $this->hasChildren,
            'isSelectable' => $this->isSelectable,
        ];
    }
369178
protected function _packages()
    {
        $installed = static::cache('_composerPackages');
        if (is_array($installed)) {
            return $installed;
        }

        $jsonPath = VENDOR_INCLUDE_PATH . 'composer/installed.json';
        $installed = [];

        if (is_readable($jsonPath)) {
            $json = (array)json_decode(file_get_contents($jsonPath), true);
            foreach ($json as $pkg) {
                $installed[$pkg['name']] = [
                    'name' => $pkg['name'],
                    'version' => $pkg['version'],
                    'version_normalized' => $pkg['version_normalized'],
                ];
            }
        }

        return static::cache('_composerPackages', $installed);
    }
747804
public static function getListByPackage($pkg)
    {
        $db = Loader::db();
        $saslHandles = $db->GetCol('select saslHandle from SystemAntispamLibraries where pkgID = ? order by saslHandle asc', array($pkg->getPackageID()));
        $libraries = array();
        foreach ($saslHandles as $saslHandle) {
            $sasl = static::getByHandle($saslHandle);
            $libraries[] = $sasl;
        }

        return $libraries;
    }
965926
public function findPackages()
    {
        $root = new Package($this->composer->getPackage(), $this->composer);
        $this->plainList[$root->getPrettyName()] = $root;
        foreach ($this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages() as $package) {
            $this->plainList[$package->getPrettyName()] = new Package($package, $this->composer);
        }
        $this->orderedList = [];
        $this->iteratePackage($root, true);

        $res = [];
        foreach (array_keys($this->orderedList) as $name) {
            $res[] = $this->plainList[$name];
        }

        return $res;
    }
1094883
protected function getPackages()
	{
		if ( ! is_null($package = $this->input->getArgument('package')))
		{
			return array($package);
		}
		elseif ( ! is_null($bench = $this->input->getOption('bench')))
		{
			return array($bench);
		}

		return $this->findAllAssetPackages();
	}
1265588
public function findAll()
    {
        $repos = array();
        foreach ($this->repository->findAll() as $repo) {
            $this->loadPackagistInfos($repo);
            $repos[] = $repo;
        }

        return $repos;
    }
301045
public function getDependentPackages($isDevMode)
    {
        $packages = [];
        $rootPackage = $this->composer->getPackage();
        if ($this->isDependentPackage($rootPackage, (bool)$isDevMode)) {
            $packages[] = new PackageWrapper($rootPackage, getcwd());
        }
        $manager = $this->composer->getInstallationManager();
        foreach ($this->composer->getRepositoryManager()->getLocalRepository()->getPackages() as $package) {
            if ($this->isDependentPackage($package, $isDevMode)) {
                $packages[] = new PackageWrapper($package, $manager->getInstallPath($package));
            }
        }
        return $packages;
    }
1289849
public static function getListByPackage($pkg)
    {
        $db = Loader::db();
        $list = [];

        $q = $db->query('SELECT * FROM AuthenticationTypes WHERE pkgID=?', [$pkg->getPackageID()]);
        while ($row = $q->FetchRow()) {
            $list[] = self::load($row);
        }

        return $list;
    }
622899
public function getServiceNamesByType($types, $only_active = false)
    {
        $names = [];
        $map = $this->getServiceNameTypeMap($only_active);
        if (is_string($types)) {
            $types = array_map('trim', explode(',', trim($types, ',')));
        }
        foreach ($map as $name => $type) {
            if (false !== array_search($type, $types)) {
                $names[] = $name;
            }
        }

        return $names;
    }
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;
    }
648010
public static function getSubscribedEvents(): array
    {
        return [
            PackageEvents::POST_PACKAGE_INSTALL => 'postPackageInstall',
            PackageEvents::POST_PACKAGE_UPDATE => 'postPackageUpdate',
            PackageEvents::PRE_PACKAGE_UNINSTALL => 'prePackageUninstall',
            ScriptEvents::POST_INSTALL_CMD => 'runScheduledTasks',
            ScriptEvents::POST_UPDATE_CMD => 'runScheduledTasks',
        ];
    }
1143527
public static function getPackages() {
    $path = drupal_get_path('profile', 'openy');
    $packages = Yaml::decode(file_get_contents($path . '/openy.packages.yml'));
    // Demo content package should be hidden.
    if (isset($packages['demo'])) {
      unset($packages['demo']);
    }

    return $packages;
  }
1133596
public function getFrozenPackages()
    {
        $frozenPackages = [];
        if ($this->bootstrap->getContext()->isDevelopment()) {
            /** @var PackageInterface $package */
            foreach ($this->packages as $packageKey => $package) {
                if (isset($this->packageStatesConfiguration['packages'][$package->getComposerName()]['frozen']) &&
                    $this->packageStatesConfiguration['packages'][$package->getComposerName()]['frozen'] === true
                ) {
                    $frozenPackages[$packageKey] = $package;
                }
            }
        }

        return $frozenPackages;
    }
340485
public static function getPrimaryKeys($avail_fields, $names_only = false)
    {
        $keys = [];
        foreach ($avail_fields as $info) {
            if ($info->isPrimaryKey) {
                $keys[] = ($names_only ? $info->name : $info);
            }
        }

        return $keys;
    }
111507
def find_all(name, opts={})
      # opts ||= {}
      all = [@packages.select {|x| x.name.to_s == name.to_s },
      find_all_by_provides(name, opts)].flatten.compact
      filter(all, opts)
    end
483620
public function getOutdatedPackages(array $excluded = [])
    {
        // Get all installed and required packages.
        $installed = $this->composer->getInstalledPackages();
        $required = $this->composer->getRequiredPackages();

        $outdated = [];

        // Get the installed version number of the required packages.
        $packages = array_intersect_key($installed, $required);

        foreach ($packages as $package) {
            $name = $package['name'];
            $version = Version::normalize($package['version']);
            $prettyVersion = $required[$name]['version'];
            $devDependency = $package['devDependency'];

            if (in_array($name, $excluded)) {
                continue;
            }

            $package = new Package($name, $version, $prettyVersion, $devDependency);

            if ($package->isOutdated()) {
                $outdated[] = $package;
            }
        }

        return $outdated;
    }