{@inheritdoc}

@see FactoryInterface::getPackageStats()
516287
public function getPackageStats(Package $package, $localeID)
    {
        return $this->getMoFileStats($package->getPackagePath() . '/' . DIRNAME_LANGUAGES . '/' . $localeID . '/LC_MESSAGES/messages.mo');
    }
543679
public function getPackages()
    {
        if ($this->packages === null) {
            $this->packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
            $this->packages[] = $this->composer->getPackage();
        }

        return $this->packages;
    }
1309909
protected function getPackages()
    {
        if (! is_null($package = $this->input->getArgument('package'))) {
            if (Str::length($package) > 3) {
                $package = Str::snake($package, '-');
            } else {
                $package = Str::lower($package);
            }

            return array($package);
        }

        return $this->findAllAssetPackages();
    }
370200
protected function getPackageReleases()
    {
        if (empty($url = $this->config['repository_url'])) {
            throw new \Exception('No repository specified. Please enter a valid URL in your config.');
        }

        $format = str_replace('_VERSION_', '\d+\.\d+\.\d+',
                    str_replace('.', '\.', $this->config['pkg_filename_format'])
                  ).'.zip';
        $count = preg_match_all(
            "/<a.*href=\".*$format\">($format)<\/a>/i",
            $this->client->get($url)->getBody()->getContents(),
            $files);
        $collection = [];
        $url = preg_replace('/\/$/', '', $url);
        for ($i = 0; $i < $count; $i++) {
            $basename = preg_replace("/^$this->prepend/", '',
                          preg_replace("/$this->append$/", '',
                            preg_replace('/.zip$/', '', $files[1][$i])
                        ));
            array_push($collection, (object) [
                'name' => $basename,
                'zipball_url' => $url.'/'.$files[1][$i],
            ]);
        }
        // Sort collection alphabetically descending to have newest package as first
        array_multisort($collection, SORT_DESC);

        return new Collection($collection);
    }
875678
public function getAllInstalledPackages(bool $rescan = false): array
    {
        if (!$rescan && !empty(self::$allInstalledPackages)) {
            return self::$allInstalledPackages;
        }

        $compiledFile = $this->pathHelper->realize('{MELIOR_BASE}/Data/Persistent/Compiler/Packages/package.map');
        if (!$rescan && is_file($compiledFile)) {
            $result = \unserialize(\file_get_contents($compiledFile));
        } else {
            $result = array_merge(
                $this->getLibraries($rescan),
                $this->getPlugins($rescan),
                $this->getApplicationPackages($rescan)
            );
        }

        self::$allInstalledPackages = $result;

        return $result;
    }
220890
public static function getRemotePackages()
	{
		$remoteRepos = self::_getRemoteRepositories();
		$remotePackages = array();
		foreach ($remoteRepos as $repo)
		{
			if (method_exists($repo, "getRepoConfig"))
			{
				$config = $repo->getRepoConfig();
				if (is_array($config) && isset($config['type']) && $config['type'] != 'composer')
				{
					$packages = $repo->getPackages();
					foreach ($packages as $package)
					{
						$remotePackages[$package->getName()] = $package;
					}
				}
			}
		}
		return $remotePackages;
	}
442656
protected function getPackagesData()
    {
        $composer = $this->event->getComposer();
        $locker = $composer->getLocker();
        if (isset($locker)) {
            $lockData = $locker->getLockData();
            $allPackages = isset($lockData['packages']) ? $lockData['packages'] : array();
        }

        $packages = array();
        // Only add those packages that we can reasonably
        // assume are components into our packages list
        foreach ($allPackages as $package) {
            if (isset($package['extra']['c33s-building-blocks']) && is_array($package['extra']['c33s-building-blocks'])) {
                $packages[] = $package;
            }
        }

        // Add the root package to the packages list.
        $root = $composer->getPackage();
        if ($root) {
            $dumper = new ArrayDumper();
            $package = $dumper->dump($root);

            if (isset($package['extra']['c33s-building-blocks']) && is_array($package['extra']['c33s-building-blocks'])) {
                $packages[] = $package;
            }
        }

        return $packages;
    }
827092
public function getCoreStats($coreVersion, $localeID, $progressLimit = null)
    {
        return $this->getPackageStats(static::CORE_PACKAGE_HANDLE, $coreVersion, $localeID, $progressLimit);
    }
505823
public function getPackages( $keys = null )
    {
        $packages = array();

        if ( empty( $keys ) )
        {
            foreach ( $this as $subPackages )
            {
                $packages = array_merge(
                    $packages,
                    array_values( $subPackages )
                );
            }
        }
        else if ( is_array( $keys ) )
        {
            foreach ( $keys as $key )
            {
                $key = (string) $key;

                if ( ! empty( $this[$key] ) )
                {
                    $packages = array_merge(
                        $packages,
                        array_values( $this[$key] )
                    );
                }
            }
        }
        else
        {
            $packages = $this[(string) $keys];
        }

        return array_unique( array_map( 'strtolower', $packages ) );
    }
588738
private function getPackageVersionSubscriptions(PackageEntity $package)
    {
        $result = [];
        $me = $this->getAccessHelper()->getUserEntity('current');
        $repo = $this->app->make(PackageVersionSubscriptionRepository::class);
        /* @var PackageVersionSubscriptionRepository $repo */
        $pvsList = $repo->createQueryBuilder('s')
            ->innerJoin(PackageVersionEntity::class, 'pv', 'WITH', 's.packageVersion = pv.id')
            ->where('s.user = :user')->setParameter('user', $me)
            ->andWhere('pv.package = :package')->setParameter('package', $package)
            ->getQuery()
                ->execute();
        foreach ($package->getSortedVersions(true) as $packageVersion) {
            $pvs = null;
            foreach ($pvsList as $existing) {
                if ($existing->getPackageVersion() === $packageVersion) {
                    $pvs = $existing;
                    break;
                }
            }
            if ($pvs === null) {
                $pvs = PackageVersionSubscriptionEntity::create($me, $packageVersion, false);
            }
            $result[] = $pvs;
        }

        return $result;
    }
1222647
public function getPackages()
    {
        if(empty($this->packages)) {
            
            $xml = $this->getXmlContent();
            foreach($xml->packages->package as $package)
            {
                $data = (array)$package;
                extract($data['@attributes']);
                // checksums may not exist on some remote packages
                if(!isset($checksum)) {
                    $checksum = null;
                }                
                $this->packages[] = new Package($id, $checksum, $name, $subdir, $unzip, $url);
            }            
        }
        return $this->packages;
                
    }
372500
protected function getPackage(PackageEvent $event)
    {
        $operation = $event->getOperation();
        
        if (method_exists($operation, 'getPackage')) {
            return $operation->getPackage();
        }
        
        return $operation->getTargetPackage();
    }
217723
public function getInstalledPackages()
    {
        $packages = [];

        $content = $this->getFileContents('composer.lock');

        foreach (['packages', 'packages-dev'] as $key) {
            if (!isset($content[$key])) {
                continue;
            }

            foreach ($content[$key] as $package) {
                $name = $package['name'];

                $packages[$name] = [
                    'name' => $name,
                    'version' => $package['version'],
                    'devDependency' => $key === 'packages-dev',
                ];
            }
        }

        if (empty($packages)) {
            throw new LogicException('We couldn\'t find any installed packages.');
        }

        return $packages;
    }
681735
public static function getGlobalVariables(AbstractPackage $package = null)
    {
        if (!static::$messages) {
            static::$messages = $package->getContainer()
                ->get('session')
                ->getFlashBag()
                ->takeAll();
        }

        $container = $package->getContainer();

        return [
            'uri' => $container->get('uri'),
            'app' => $container->get('application'),
            'package' => $package,
            'router' => $package->router,
            'asset' => $container->get('asset'),
            'messages' => static::$messages,
            'translator' => $container->get('language'),
            'datetime' => new \DateTime(
                'now',
                new \DateTimeZone($container->get('config')->get('system.timezone', 'UTC'))
            ),
        ];
    }
772499
public function getPackageHandle()
    {
        $pkgID = $this->getPackageID();

        return empty($pkgID) ? false : PackageList::getHandle($pkgID);
    }
1213182
public function getPackage($name)
    {
        return isset($this->packages[$name = strtolower($name)]) ? $this->packages[$name] : null;
    }
825123
public void getExportedPackages(Set<String> exportedPackages) {
		if (exportedPackages != null) {
			exportedPackages.add(getCodeElementExtractor().getBasePackage());
			exportedPackages.add(getCodeElementExtractor().getBuilderPackage());
			if (getCodeBuilderConfig().isISourceAppendableEnable()) {
				exportedPackages.add(getCodeElementExtractor().getAppenderPackage());
			}
		}
	}