Retrieve the libraries installed by a package.

@param \Concrete\Core\Entity\Package|int $pkg the package instance (or its ID)

@return static[]
973589
public static function getListByPackage($pkg)
    {
        if (is_object($pkg)) {
            $pkgID = $pkg->getPackageID();
        } else {
            $pkgID = (int) $pkg;
        }
        $app = Facade::getFacadeApplication();
        $db = $app->make('database')->connection();
        $libraries = [];
        foreach ($db->fetchAll('select sclHandle from SystemCaptchaLibraries where pkgID = ? order by sclHandle asc', [$pkgID]) as $row) {
            $scl = static::getByHandle($row['sclHandle']);
            $libraries[] = $scl;
        }

        return $libraries;
    }
509847
public function getExtensionsByPackage($key, $packageName) {
		if ($this->packages->has($packageName)) {
			$pkg = $this->packages->get($packageName);
			if ($pkg->has($key)) {
				return $pkg->get($key);
			}
		}
		
		return [];
	}
822147
private function getDescSortedVersions(array $packages): array
    {
        usort($packages, function (PackageInterface $a, PackageInterface $b) {
            return version_compare($b->getVersion(), $a->getVersion());
        });

        return $packages;
    }
652076
function fetchAvailablePackages( $type = false )
    {
        $typeArray  = array();
        if ( $type )
            $typeArray['type'] = $type;

        $packageList = eZPackage::fetchPackages( array( 'db_available' => false ), $typeArray );

        return $packageList;
    }
1116511
public static function getListByPackage($pkg)
    {
        $em = \ORM::entityManager();
        return $em->getRepository('\Concrete\Core\Entity\File\StorageLocation\Type\Type')->findBy(
            array('pkgID' => $pkg->getPackageID()), array('fslTypeID' => 'asc')
        );
    }
602527
public function get_installed_plugins($type) {
        $this->load_installed_plugins();
        if (isset($this->installedplugins[$type])) {
            return $this->installedplugins[$type];
        }
        return array();
    }
1221117
private function get_packages()
    {
        if ($this->input->getOption('all') === true) {
            $packages = [];
            
            // Add all package files to $packages array.
            foreach (Config::get('services.providers') as $package) {
                $packages[ $package ] = $package::get_files_to_publish();
            }

            return $packages;
        }

        $package = $this->input->getOption('package');

        // If no package specified.
        if ($package === null) {
            $package = $this->package_prompt();
        }

        // If the package chosen does not exist.
        if (! \class_exists($package)) {
            $this->output->writeln("<error>The package [$package] could not be found.</error>");
            exit;
        }

        // When running publish via the theme installer, the current theme isn't active yet.
        // We need to trick WP into thinking it is.
        if (isset($this->root)) {
            $parts = \explode('/', $this->root);

            if ($parts[0] == $this->root) {
                $parts = \explode('\\', $this->root);
            }

            $theme_name = \end($parts);

            \add_filter(
                'stylesheet',
                function () use ($theme_name) {
                    return $theme_name;
                }
            );
            \add_filter(
                'template',
                function () use ($theme_name) {
                    return $theme_name;
                }
            );

            // Resolve the package manually.
            $provider = Container::resolve($package);
            $provider->register();
        }

        return [
            $package => $package::get_files_to_publish(),
        ];
    }
1062646
protected function retrieveInstalledBundles()
    {
        $finder = new Finder();
        $autoloaders = $finder->files()->depth(0)->name('*.json')->in($this->autoloadersPath);
        foreach ($autoloaders as $autoloader) {
            $bundleName = strtolower(basename($autoloader->getFilename(), '.json'));
            $jsonAutoloader = new JsonAutoloader($bundleName, (string)$autoloader);
            $this->installedBundles[$bundleName] = $jsonAutoloader;
        }
    }
725643
public function getInstalledPlugins()
    {
        $arr = array();

        foreach ($this->pluginInformations as $single) {
            $arr = array_merge($arr, $single->getInstalledPlugins());
        }

        return $arr;
    }
510828
protected function gatherLoadedPackagesHandles($packages)
    {
        $packages = (array) $packages;
        if (!$packages) {
            $plugins = $this->container->getPlugins();
            foreach ($plugins as $plugin) {
                $path = (new ReflectionClass($plugin))->getFileName();
                preg_match('/vendor\/([^\/]+)\/([^\/]+)/', $path, $handle);
                if (count($handle) !== 3) {
                    continue;
                }

                $packages[] = $handle[1].'/'.$handle[2];
            }
        }

        return $packages;
    }
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;
    }
184807
def get_deps_list(self, pkg_name, installed_distros=None):
        
        # https://github.com/Miserlou/Zappa/issues/1478.  Using `pkg_resources`
        # instead of `pip` is the recommended approach.  The usage is nearly
        # identical.
        import pkg_resources
        deps = []
        if not installed_distros:
            installed_distros = pkg_resources.WorkingSet()
        for package in installed_distros:
            if package.project_name.lower() == pkg_name.lower():
                deps = [(package.project_name, package.version)]
                for req in package.requires():
                    deps += self.get_deps_list(pkg_name=req.project_name, installed_distros=installed_distros)
        return list(set(deps))
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;
    }
243876
public static function listLibraries($type)
    {
        $home = Phing::getProperty(Phing::PHING_HOME);
        if ($home == null) {
            return [];
        }
        $currentWorkingDir = getcwd();
        chdir($home);
        exec('composer show --' . $type, $packages, $code);
        chdir($currentWorkingDir);

        return $packages;
    }
479731
protected function getPackages()
    {
        $translator = $this->container->get('translator');
        $errorMessage = $translator->trans('settings.version.error_parsing_composer');

        $composerPath = $this->getLockPath();
        if (!file_exists($composerPath)) {
            throw new ParseException(
                $translator->trans('settings.version.composer_lock_not_found')
            );
        }

        $json = file_get_contents($composerPath);
        $result = json_decode($json, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new ParseException($errorMessage.' (#'.json_last_error().')');
        }

        if (array_key_exists('packages', $result) && is_array($result['packages'])) {
            return $result['packages'];
        }

        // No package list in JSON structure
        throw new ParseException($errorMessage);
    }
1248441
public function findBundleClasses(): array
    {
        /** @var string[][] $bundleSets */
        $bundleSets = [];

        $modules = $this->packageRepository->findModules();
        foreach ($modules as $module) {
            $extra = $module->getExtra();
            $this->validateBundlesSectionInExtra($extra);
            if (empty($extra['phplist/core']['bundles'])) {
                continue;
            }

            $bundleSets[$module->getName()] = $extra['phplist/core']['bundles'];
        }

        return $bundleSets;
    }
638225
protected function findAllAssetPackages()
    {
        $packages = array();

        //
        $namespaces = $this->dispatcher->getHints();

        foreach ($namespaces as $name => $hint) {
            $packages[] = $name;
        }

        return $packages;
    }