im/vendor/composer/InstalledVersions.php

976 lines
21 KiB
PHP
Raw Permalink Normal View History

2023-09-26 18:09:46 +08:00
<?php
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
class InstalledVersions
{
private static $installed = array (
'root' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
'name' => 'topthink/think',
),
'versions' =>
array (
'adbario/php-dot-notation' =>
array (
'pretty_version' => '2.5.0',
'version' => '2.5.0.0',
'aliases' =>
array (
),
'reference' => '081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae',
),
'alibabacloud/client' =>
array (
'pretty_version' => '1.5.32',
'version' => '1.5.32.0',
'aliases' =>
array (
),
'reference' => '5bc6f6d660797dcee2c3aef29700ab41ee764f4d',
),
'aliyuncs/oss-sdk-php' =>
array (
'pretty_version' => 'v2.6.0',
'version' => '2.6.0.0',
'aliases' =>
array (
),
'reference' => '572d0f8e099e8630ae7139ed3fdedb926c7a760f',
),
'char0n/ffmpeg-php' =>
array (
'pretty_version' => '3.2.2',
'version' => '3.2.2.0',
'aliases' =>
array (
),
'reference' => '9a38fdc2a3b2bf2d5df9d28a571f05a1e71c0cf8',
),
'clagiordano/weblibs-configmanager' =>
array (
'pretty_version' => 'v1.2.0',
'version' => '1.2.0.0',
'aliases' =>
array (
),
'reference' => '5c8ebcc62782313b1278afe802b120d18c07a059',
),
'desarrolla2/cache' =>
array (
'pretty_version' => 'v2.1.3',
'version' => '2.1.3.0',
'aliases' =>
array (
),
'reference' => 'cbc42cae703e6f8cc9e17231f083304f0038318e',
),
'doctrine/deprecations' =>
array (
'pretty_version' => 'v1.1.1',
'version' => '1.1.1.0',
'aliases' =>
array (
),
'reference' => '612a3ee5ab0d5dd97b7cf3874a6efe24325efac3',
),
'doctrine/lexer' =>
array (
'pretty_version' => '2.1.0',
'version' => '2.1.0.0',
'aliases' =>
array (
),
'reference' => '39ab8fcf5a51ce4b85ca97c7a7d033eb12831124',
),
'dragonmantank/cron-expression' =>
array (
'pretty_version' => 'v3.3.3',
'version' => '3.3.3.0',
'aliases' =>
array (
),
'reference' => 'adfb1f505deb6384dc8b39804c5065dd3c8c8c0a',
),
'egulias/email-validator' =>
array (
'pretty_version' => '3.2.6',
'version' => '3.2.6.0',
'aliases' =>
array (
),
'reference' => 'e5997fa97e8790cdae03a9cbd5e78e45e3c7bda7',
),
'guzzlehttp/command' =>
array (
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => '2aaa2521a8f8269d6f5dfc13fe2af12c76921034',
),
'guzzlehttp/guzzle' =>
array (
'pretty_version' => '6.5.8',
'version' => '6.5.8.0',
'aliases' =>
array (
),
'reference' => 'a52f0440530b54fa079ce76e8c5d196a42cad981',
),
'guzzlehttp/guzzle-services' =>
array (
'pretty_version' => '1.1.3',
'version' => '1.1.3.0',
'aliases' =>
array (
),
'reference' => '9e3abf20161cbf662d616cbb995f2811771759f7',
),
'guzzlehttp/promises' =>
array (
'pretty_version' => '1.5.3',
'version' => '1.5.3.0',
'aliases' =>
array (
),
'reference' => '67ab6e18aaa14d753cc148911d273f6e6cb6721e',
),
'guzzlehttp/psr7' =>
array (
'pretty_version' => '1.9.1',
'version' => '1.9.1.0',
'aliases' =>
array (
),
'reference' => 'e4490cabc77465aaee90b20cfc9a770f8c04be6b',
),
'jasny/sso' =>
array (
'pretty_version' => 'v0.3.0',
'version' => '0.3.0.0',
'aliases' =>
array (
),
'reference' => '0cb18c072e7b14db3d2d2549c051f41ca837e5e9',
),
'jasny/validation-result' =>
array (
'pretty_version' => 'v1.1.2',
'version' => '1.1.2.0',
'aliases' =>
array (
),
'reference' => 'fbce54837c8414cf5af22981ac33b26eb13b2a51',
),
'league/flysystem' =>
array (
'pretty_version' => '1.1.10',
'version' => '1.1.10.0',
'aliases' =>
array (
),
'reference' => '3239285c825c152bcc315fe0e87d6b55f5972ed1',
),
'league/flysystem-cached-adapter' =>
array (
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'aliases' =>
array (
),
'reference' => 'd1925efb2207ac4be3ad0c40b8277175f99ffaff',
),
'league/mime-type-detection' =>
array (
'pretty_version' => '1.13.0',
'version' => '1.13.0.0',
'aliases' =>
array (
),
'reference' => 'a6dfb1194a2946fcdc1f38219445234f65b35c96',
),
'liz/flysystem-qiniu' =>
array (
'pretty_version' => 'v1.23',
'version' => '1.23.0.0',
'aliases' =>
array (
),
'reference' => '24af0f95644fcf66e82cc04ce840f31f6450e026',
),
'mtdowling/cron-expression' =>
array (
'replaced' =>
array (
0 => '^1.0',
),
),
'mtdowling/jmespath.php' =>
array (
'pretty_version' => '2.7.0',
'version' => '2.7.0.0',
'aliases' =>
array (
),
'reference' => 'bbb69a935c2cbb0c03d7f481a238027430f6440b',
),
'myclabs/php-enum' =>
array (
'pretty_version' => '1.8.4',
'version' => '1.8.4.0',
'aliases' =>
array (
),
'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
),
'nesbot/carbon' =>
array (
'pretty_version' => '2.70.0',
'version' => '2.70.0.0',
'aliases' =>
array (
),
'reference' => 'd3298b38ea8612e5f77d38d1a99438e42f70341d',
),
'overtrue/flysystem-cos' =>
array (
'pretty_version' => '2.1.2',
'version' => '2.1.2.0',
'aliases' =>
array (
),
'reference' => 'f6985f38f3c76a9be962f404f127b7222a9b5fff',
),
'overtrue/pinyin' =>
array (
'pretty_version' => '4.1.0',
'version' => '4.1.0.0',
'aliases' =>
array (
),
'reference' => '4d0fb4f27f0c79e81c9489e0c0ae4a4f8837eae7',
),
'psr/cache' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
),
'psr/clock' =>
array (
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => 'e41a24703d4560fd0acb709162f73b8adfc3aa0d',
),
'psr/clock-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'psr/container' =>
array (
'pretty_version' => '1.1.2',
'version' => '1.1.2.0',
'aliases' =>
array (
),
'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
),
'psr/http-message' =>
array (
'pretty_version' => '1.1',
'version' => '1.1.0.0',
'aliases' =>
array (
),
'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba',
),
'psr/http-message-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'psr/log' =>
array (
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
),
'psr/simple-cache' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
),
'qcloud/cos-sdk-v5' =>
array (
'pretty_version' => 'v2.6.6',
'version' => '2.6.6.0',
'aliases' =>
array (
),
'reference' => '9d82ccb550fe2dca1adfb53835791d314023a9a8',
),
'qcloudsms/qcloudsms_php' =>
array (
'pretty_version' => 'v0.1.4',
'version' => '0.1.4.0',
'aliases' =>
array (
),
'reference' => '48822045772d343b93c3d505d8a187cd51153c5a',
),
'qeq66/jwt' =>
array (
'pretty_version' => '3.3.5',
'version' => '3.3.5.0',
'aliases' =>
array (
),
'reference' => 'bd2fa6c51704dc18c61026c852c789224d7190a0',
),
'qiniu/php-sdk' =>
array (
'pretty_version' => 'v7.11.0',
'version' => '7.11.0.0',
'aliases' =>
array (
),
'reference' => '9ee81f0acd57fa7bb435ffe9e515d7a9fdd0489b',
),
'ralouphie/getallheaders' =>
array (
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'aliases' =>
array (
),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
),
'singka/singka-sms' =>
array (
'pretty_version' => 'v1.6',
'version' => '1.6.0.0',
'aliases' =>
array (
),
'reference' => '8db3543dfb7f28851b94de99dfe9b762f0b9b6a4',
),
'singka/ucloud-sms' =>
array (
'pretty_version' => 'v1.8',
'version' => '1.8.0.0',
'aliases' =>
array (
),
'reference' => '7c4ae42e9c7b26b4db7e6340ff03f68b15e3b0d8',
),
'swiftmailer/swiftmailer' =>
array (
'pretty_version' => 'v6.3.0',
'version' => '6.3.0.0',
'aliases' =>
array (
),
'reference' => '8a5d5072dca8f48460fce2f4131fcc495eec654c',
),
'symfony/deprecation-contracts' =>
array (
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'aliases' =>
array (
),
'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
),
'symfony/polyfill-iconv' =>
array (
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'aliases' =>
array (
),
'reference' => '6de50471469b8c9afc38164452ab2b6170ee71c1',
),
'symfony/polyfill-intl-idn' =>
array (
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'aliases' =>
array (
),
'reference' => 'ecaafce9f77234a6a449d29e49267ba10499116d',
),
'symfony/polyfill-intl-normalizer' =>
array (
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'aliases' =>
array (
),
'reference' => '8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92',
),
'symfony/polyfill-mbstring' =>
array (
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'aliases' =>
array (
),
'reference' => '42292d99c55abe617799667f454222c54c60e229',
),
'symfony/polyfill-php72' =>
array (
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'aliases' =>
array (
),
'reference' => '70f4aebd92afca2f865444d30a4d2151c13c3179',
),
'symfony/polyfill-php80' =>
array (
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'aliases' =>
array (
),
'reference' => '6caa57379c4aec19c0a12a38b59b26487dcfe4b5',
),
'symfony/process' =>
array (
'pretty_version' => 'v5.4.28',
'version' => '5.4.28.0',
'aliases' =>
array (
),
'reference' => '45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b',
),
'symfony/translation' =>
array (
'pretty_version' => 'v5.4.24',
'version' => '5.4.24.0',
'aliases' =>
array (
),
'reference' => 'de237e59c5833422342be67402d487fbf50334ff',
),
'symfony/translation-contracts' =>
array (
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'aliases' =>
array (
),
'reference' => '136b19dd05cdf0709db6537d058bcab6dd6e2dbe',
),
'symfony/translation-implementation' =>
array (
'provided' =>
array (
0 => '2.3',
),
),
'symfony/var-dumper' =>
array (
'pretty_version' => 'v4.4.47',
'version' => '4.4.47.0',
'aliases' =>
array (
),
'reference' => '1069c7a3fca74578022fab6f81643248d02f8e63',
),
'tcwei/imglazyload' =>
array (
'pretty_version' => 'v1.3',
'version' => '1.3.0.0',
'aliases' =>
array (
),
'reference' => 'f7634e446de972a26aac6973141c39ca2ea62b89',
),
'tcwei/imgsrc' =>
array (
'pretty_version' => 'v2.02',
'version' => '2.02.0.0',
'aliases' =>
array (
),
'reference' => '832342b664fc7d84e0c6253ab90407f2b565887e',
),
'thans/thinkphp-filesystem-cloud' =>
array (
'pretty_version' => 'v1.0.2',
'version' => '1.0.2.0',
'aliases' =>
array (
),
'reference' => 'b8d6d61a8b28df12ae9b1b19249b90e8a645ffa2',
),
'thans/tp-jwt-auth' =>
array (
'pretty_version' => 'v1.3.1',
'version' => '1.3.1.0',
'aliases' =>
array (
),
'reference' => 'ab5efcc0fd920df81fea2c404c34bb967ef13aba',
),
'topthink/framework' =>
array (
'pretty_version' => 'v6.0.15',
'version' => '6.0.15.0',
'aliases' =>
array (
),
'reference' => '0d248a0bf590a6ec5fd65de5e28448bcac0608f1',
),
'topthink/think' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
),
'topthink/think-captcha' =>
array (
'pretty_version' => 'v3.0.9',
'version' => '3.0.9.0',
'aliases' =>
array (
),
'reference' => 'b1ef360670578214edeebcf824aaf6ab7ee0528b',
),
'topthink/think-helper' =>
array (
'pretty_version' => 'v3.1.6',
'version' => '3.1.6.0',
'aliases' =>
array (
),
'reference' => '769acbe50a4274327162f9c68ec2e89a38eb2aff',
),
'topthink/think-multi-app' =>
array (
'pretty_version' => 'v1.0.17',
'version' => '1.0.17.0',
'aliases' =>
array (
),
'reference' => '4055a6187296ac16c0bc7bbab4ed5d92f82f791c',
),
'topthink/think-orm' =>
array (
'pretty_version' => 'v2.0.61',
'version' => '2.0.61.0',
'aliases' =>
array (
),
'reference' => '10528ebf4a5106b19c3bac9c6deae7a67ff49de6',
),
'topthink/think-queue' =>
array (
'pretty_version' => 'v3.0.9',
'version' => '3.0.9.0',
'aliases' =>
array (
),
'reference' => '654812b47dd7c708c4443deed27f212f8382e8da',
),
'topthink/think-template' =>
array (
'pretty_version' => 'v2.0.9',
'version' => '2.0.9.0',
'aliases' =>
array (
),
'reference' => '6d25642ae0e306166742fd7073dc7a159e18073c',
),
'topthink/think-trace' =>
array (
'pretty_version' => 'v1.6',
'version' => '1.6.0.0',
'aliases' =>
array (
),
'reference' => '136cd5d97e8bdb780e4b5c1637c588ed7ca3e142',
),
'topthink/think-view' =>
array (
'pretty_version' => 'v1.0.14',
'version' => '1.0.14.0',
'aliases' =>
array (
),
'reference' => 'edce0ae2c9551ab65f9e94a222604b0dead3576d',
),
'webmozart/assert' =>
array (
'pretty_version' => '1.11.0',
'version' => '1.11.0.0',
'aliases' =>
array (
),
'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991',
),
'workerman/gateway-worker' =>
array (
'pretty_version' => 'v3.1.0',
'version' => '3.1.0.0',
'aliases' =>
array (
),
'reference' => '3364be5524f3ac49fa2356377ce4c0151371d063',
),
'workerman/gatewayclient' =>
array (
'pretty_version' => 'v3.0.14',
'version' => '3.0.14.0',
'aliases' =>
array (
),
'reference' => '4362468d68251015b2b385c310252afb4d6648ed',
),
'workerman/workerman' =>
array (
'pretty_version' => 'v4.1.13',
'version' => '4.1.13.0',
'aliases' =>
array (
),
'reference' => '807780ff672775fcd08f89e573a2824e939021ce',
),
'xiaodi/think-pinyin' =>
array (
'pretty_version' => 'v1.0.0',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => '4675515d3be42bebff712383c306ff99ef279f97',
),
'xiaodi/think-pullword' =>
array (
'pretty_version' => 'v1.2.1',
'version' => '1.2.1.0',
'aliases' =>
array (
),
'reference' => '0e6f1ee141090a012dc8876209eaa3cf166c84c4',
),
'xxtime/flysystem-aliyun-oss' =>
array (
'pretty_version' => '1.5.0',
'version' => '1.5.0.0',
'aliases' =>
array (
),
'reference' => 'ae873b5919076157b9cfeaf39d2f56d2dbb39ee9',
),
'yunwuxin/think-cron' =>
array (
'pretty_version' => 'v3.0.7',
'version' => '3.0.7.0',
'aliases' =>
array (
),
'reference' => 'b54baa2c7a6ad68653d9a1e0a9b22e18ac0bcbe7',
),
),
);
private static $canGetVendors;
private static $installedByVendor = array();
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
public static function isInstalled($packageName)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return true;
}
}
return false;
}
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
return self::$installed;
}
public static function getAllRawData()
{
return self::getInstalled();
}
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
}
}
}
$installed[] = self::$installed;
return $installed;
}
}