function InstalledVersions::getInstalled
Same name in this branch
- 11.1.x vendor/composer/composer/src/Composer/InstalledVersions.php \Composer\InstalledVersions::getInstalled()
@psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
Return value
array[]
20 calls to InstalledVersions::getInstalled()
- InstalledVersions::getAllRawData in vendor/
composer/ InstalledVersions.php - Returns the raw data of all installed.php which are currently loaded for custom implementations
- InstalledVersions::getAllRawData in vendor/
composer/ composer/ src/ Composer/ InstalledVersions.php - Returns the raw data of all installed.php which are currently loaded for custom implementations
- InstalledVersions::getInstalledPackages in vendor/
composer/ InstalledVersions.php - Returns a list of all package names which are present, either by being installed, replaced or provided
- InstalledVersions::getInstalledPackages in vendor/
composer/ composer/ src/ Composer/ InstalledVersions.php - Returns a list of all package names which are present, either by being installed, replaced or provided
- InstalledVersions::getInstalledPackagesByType in vendor/
composer/ InstalledVersions.php - Returns a list of all package names with a specific type e.g. 'library'
File
-
vendor/
composer/ InstalledVersions.php, line 329
Class
- InstalledVersions
- This class is copied in every Composer installed project and available to all
Namespace
ComposerCode
private static function getInstalled() {
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\\Autoload\\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
$copiedLocalDir = false;
if (self::$canGetVendors) {
$selfDir = strtr(__DIR__, '\\', '/');
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$vendorDir = strtr($vendorDir, '\\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
}
elseif (is_file($vendorDir . '/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = (require $vendorDir . '/composer/installed.php');
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (self::$installed === null && $vendorDir . '/composer' === $selfDir) {
self::$installed = $required;
self::$installedIsLocalDir = true;
}
}
if (self::$installedIsLocalDir && $vendorDir . '/composer' === $selfDir) {
$copiedLocalDir = true;
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = (require __DIR__ . '/installed.php');
self::$installed = $required;
}
else {
self::$installed = array();
}
}
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}
return $installed;
}