You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
923 lines
20 KiB
923 lines
20 KiB
<?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' => 'karsonzhang/fastadmin',
|
|
),
|
|
'versions' =>
|
|
array (
|
|
'adbario/php-dot-notation' =>
|
|
array (
|
|
'pretty_version' => '2.5.0',
|
|
'version' => '2.5.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae',
|
|
),
|
|
'alibabacloud/credentials' =>
|
|
array (
|
|
'pretty_version' => '1.2.0',
|
|
'version' => '1.2.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'ebcda2e628180b4df235b46a86e1d014c561f5d9',
|
|
),
|
|
'alibabacloud/darabonba-openapi' =>
|
|
array (
|
|
'pretty_version' => '0.2.13',
|
|
'version' => '0.2.13.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '0213396384e2c064eefd614f3dd53636a63f987f',
|
|
),
|
|
'alibabacloud/endpoint-util' =>
|
|
array (
|
|
'pretty_version' => '0.1.1',
|
|
'version' => '0.1.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5',
|
|
),
|
|
'alibabacloud/gateway-spi' =>
|
|
array (
|
|
'pretty_version' => '1.0.0',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '7440f77750c329d8ab252db1d1d967314ccd1fcb',
|
|
),
|
|
'alibabacloud/imagesearch-20201214' =>
|
|
array (
|
|
'pretty_version' => '4.0.3',
|
|
'version' => '4.0.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'db6198300ab2342e3105cb940678194d0d5c72ab',
|
|
),
|
|
'alibabacloud/openapi-util' =>
|
|
array (
|
|
'pretty_version' => '0.2.1',
|
|
'version' => '0.2.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'f31f7bcd835e08ca24b6b8ba33637eb4eceb093a',
|
|
),
|
|
'alibabacloud/openplatform-20191219' =>
|
|
array (
|
|
'pretty_version' => '2.0.1',
|
|
'version' => '2.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '02ffa72369f8649214f1cfa336b52a544735f517',
|
|
),
|
|
'alibabacloud/tea' =>
|
|
array (
|
|
'pretty_version' => '3.2.1',
|
|
'version' => '3.2.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '1619cb96c158384f72b873e1f85de8b299c9c367',
|
|
),
|
|
'alibabacloud/tea-fileform' =>
|
|
array (
|
|
'pretty_version' => '0.3.4',
|
|
'version' => '0.3.4.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '4bf0c75a045c8115aa8cb1a394bd08d8bb833181',
|
|
),
|
|
'alibabacloud/tea-oss-sdk' =>
|
|
array (
|
|
'pretty_version' => '0.3.6',
|
|
'version' => '0.3.6.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'e28e70e2842b2e4da031a774209231bf08d7965c',
|
|
),
|
|
'alibabacloud/tea-oss-utils' =>
|
|
array (
|
|
'pretty_version' => '0.3.1',
|
|
'version' => '0.3.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '19f58fc509347f075664e377742d4f9e18465372',
|
|
),
|
|
'alibabacloud/tea-utils' =>
|
|
array (
|
|
'pretty_version' => '0.2.21',
|
|
'version' => '0.2.21.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '5039e45714c6456186d267f5d81a4b260a652495',
|
|
),
|
|
'alibabacloud/tea-xml' =>
|
|
array (
|
|
'pretty_version' => '0.2.4',
|
|
'version' => '0.2.4.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '3e0c000bf536224eebbac913c371bef174c0a16a',
|
|
),
|
|
'easywechat-composer/easywechat-composer' =>
|
|
array (
|
|
'pretty_version' => '1.4.1',
|
|
'version' => '1.4.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '3fc6a7ab6d3853c0f4e2922539b56cc37ef361cd',
|
|
),
|
|
'ezyang/htmlpurifier' =>
|
|
array (
|
|
'pretty_version' => 'v4.18.0',
|
|
'version' => '4.18.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'cb56001e54359df7ae76dc522d08845dc741621b',
|
|
),
|
|
'fgrosse/phpasn1' =>
|
|
array (
|
|
'pretty_version' => 'v2.5.0',
|
|
'version' => '2.5.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '42060ed45344789fb9f21f9f1864fc47b9e3507b',
|
|
),
|
|
'guzzlehttp/guzzle' =>
|
|
array (
|
|
'pretty_version' => '7.8.2',
|
|
'version' => '7.8.2.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'f4152d9eb85c445fe1f992001d1748e8bec070d2',
|
|
),
|
|
'guzzlehttp/promises' =>
|
|
array (
|
|
'pretty_version' => '2.0.3',
|
|
'version' => '2.0.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8',
|
|
),
|
|
'guzzlehttp/psr7' =>
|
|
array (
|
|
'pretty_version' => '1.9.1',
|
|
'version' => '1.9.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'e4490cabc77465aaee90b20cfc9a770f8c04be6b',
|
|
),
|
|
'karsonzhang/fastadmin' =>
|
|
array (
|
|
'pretty_version' => '1.0.0+no-version-set',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => NULL,
|
|
),
|
|
'karsonzhang/fastadmin-addons' =>
|
|
array (
|
|
'pretty_version' => '1.4.0',
|
|
'version' => '1.4.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '12b0b146bbdcb12c9f50c96baa3b7cc5f4c48ad6',
|
|
),
|
|
'lizhichao/one-sm' =>
|
|
array (
|
|
'pretty_version' => '1.10',
|
|
'version' => '1.10.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '687a012a44a5bfd4d9143a0234e1060543be455a',
|
|
),
|
|
'lpilp/guomi' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.9',
|
|
'version' => '1.0.9.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '9d342416acec45db0d38dd3a8fbc1904463e6b31',
|
|
),
|
|
'maennchen/zipstream-php' =>
|
|
array (
|
|
'pretty_version' => '2.2.6',
|
|
'version' => '2.2.6.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '30ad6f93cf3efe4192bc7a4c9cad11ff8f4f237f',
|
|
),
|
|
'markbaker/complex' =>
|
|
array (
|
|
'pretty_version' => '3.0.2',
|
|
'version' => '3.0.2.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '95c56caa1cf5c766ad6d65b6344b807c1e8405b9',
|
|
),
|
|
'markbaker/matrix' =>
|
|
array (
|
|
'pretty_version' => '3.0.1',
|
|
'version' => '3.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '728434227fe21be27ff6d86621a1b13107a2562c',
|
|
),
|
|
'mdanter/ecc' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.0',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '34e2eec096bf3dcda814e8f66dd91ae87a2db7cd',
|
|
),
|
|
'monolog/monolog' =>
|
|
array (
|
|
'pretty_version' => '2.9.3',
|
|
'version' => '2.9.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'a30bfe2e142720dfa990d0a7e573997f5d884215',
|
|
),
|
|
'myclabs/php-enum' =>
|
|
array (
|
|
'pretty_version' => '1.8.4',
|
|
'version' => '1.8.4.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
|
|
),
|
|
'nelexa/zip' =>
|
|
array (
|
|
'pretty_version' => '4.0.2',
|
|
'version' => '4.0.2.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '88a1b6549be813278ff2dd3b6b2ac188827634a7',
|
|
),
|
|
'overtrue/pinyin' =>
|
|
array (
|
|
'pretty_version' => '3.0.6',
|
|
'version' => '3.0.6.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '3b781d267197b74752daa32814d3a2cf5d140779',
|
|
),
|
|
'overtrue/socialite' =>
|
|
array (
|
|
'pretty_version' => '2.0.24',
|
|
'version' => '2.0.24.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'ee7e7b000ec7d64f2b8aba1f6a2eec5cdf3f8bec',
|
|
),
|
|
'overtrue/wechat' =>
|
|
array (
|
|
'pretty_version' => '4.6.0',
|
|
'version' => '4.6.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '52af4cbe777cd4aea307beafa0a4518c347467b1',
|
|
),
|
|
'phpoffice/phpspreadsheet' =>
|
|
array (
|
|
'pretty_version' => '1.29.4',
|
|
'version' => '1.29.4.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '7ca7e325dca3adb6a598385aab81f527b8d6c75d',
|
|
),
|
|
'pimple/pimple' =>
|
|
array (
|
|
'pretty_version' => 'v3.5.0',
|
|
'version' => '3.5.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'a94b3a4db7fb774b3d78dad2315ddc07629e1bed',
|
|
),
|
|
'psr/cache' =>
|
|
array (
|
|
'pretty_version' => '1.0.1',
|
|
'version' => '1.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
|
|
),
|
|
'psr/cache-implementation' =>
|
|
array (
|
|
'provided' =>
|
|
array (
|
|
0 => '1.0|2.0',
|
|
),
|
|
),
|
|
'psr/container' =>
|
|
array (
|
|
'pretty_version' => '2.0.2',
|
|
'version' => '2.0.2.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
|
|
),
|
|
'psr/event-dispatcher' =>
|
|
array (
|
|
'pretty_version' => '1.0.0',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
|
|
),
|
|
'psr/event-dispatcher-implementation' =>
|
|
array (
|
|
'provided' =>
|
|
array (
|
|
0 => '1.0',
|
|
),
|
|
),
|
|
'psr/http-client' =>
|
|
array (
|
|
'pretty_version' => '1.0.3',
|
|
'version' => '1.0.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
|
|
),
|
|
'psr/http-client-implementation' =>
|
|
array (
|
|
'provided' =>
|
|
array (
|
|
0 => '1.0',
|
|
),
|
|
),
|
|
'psr/http-factory' =>
|
|
array (
|
|
'pretty_version' => '1.0.2',
|
|
'version' => '1.0.2.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'e616d01114759c4c489f93b099585439f795fe35',
|
|
),
|
|
'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/log-implementation' =>
|
|
array (
|
|
'provided' =>
|
|
array (
|
|
0 => '1.0.0 || 2.0.0 || 3.0.0',
|
|
),
|
|
),
|
|
'psr/simple-cache' =>
|
|
array (
|
|
'pretty_version' => '1.0.1',
|
|
'version' => '1.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
|
|
),
|
|
'psr/simple-cache-implementation' =>
|
|
array (
|
|
'provided' =>
|
|
array (
|
|
0 => '1.0|2.0',
|
|
),
|
|
),
|
|
'ralouphie/getallheaders' =>
|
|
array (
|
|
'pretty_version' => '3.0.3',
|
|
'version' => '3.0.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
|
|
),
|
|
'symfony/cache' =>
|
|
array (
|
|
'pretty_version' => 'v5.4.46',
|
|
'version' => '5.4.46.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '0fe08ee32cec2748fbfea10c52d3ee02049e0f6b',
|
|
),
|
|
'symfony/cache-contracts' =>
|
|
array (
|
|
'pretty_version' => 'v2.5.3',
|
|
'version' => '2.5.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'fee6db04d913094e2fb55ff8e7db5685a8134463',
|
|
),
|
|
'symfony/cache-implementation' =>
|
|
array (
|
|
'provided' =>
|
|
array (
|
|
0 => '1.0|2.0',
|
|
),
|
|
),
|
|
'symfony/deprecation-contracts' =>
|
|
array (
|
|
'pretty_version' => 'v2.5.3',
|
|
'version' => '2.5.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '80d075412b557d41002320b96a096ca65aa2c98d',
|
|
),
|
|
'symfony/event-dispatcher' =>
|
|
array (
|
|
'pretty_version' => 'v5.4.45',
|
|
'version' => '5.4.45.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '72982eb416f61003e9bb6e91f8b3213600dcf9e9',
|
|
),
|
|
'symfony/event-dispatcher-contracts' =>
|
|
array (
|
|
'pretty_version' => 'v2.5.3',
|
|
'version' => '2.5.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '540f4c73e87fd0c71ca44a6aa305d024ac68cb73',
|
|
),
|
|
'symfony/event-dispatcher-implementation' =>
|
|
array (
|
|
'provided' =>
|
|
array (
|
|
0 => '2.0',
|
|
),
|
|
),
|
|
'symfony/finder' =>
|
|
array (
|
|
'pretty_version' => 'v5.4.45',
|
|
'version' => '5.4.45.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '63741784cd7b9967975eec610b256eed3ede022b',
|
|
),
|
|
'symfony/http-foundation' =>
|
|
array (
|
|
'pretty_version' => 'v5.4.46',
|
|
'version' => '5.4.46.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '168b77c71e6f02d8fc479db78beaf742a37d3cab',
|
|
),
|
|
'symfony/polyfill-mbstring' =>
|
|
array (
|
|
'pretty_version' => 'v1.31.0',
|
|
'version' => '1.31.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341',
|
|
),
|
|
'symfony/polyfill-php73' =>
|
|
array (
|
|
'pretty_version' => 'v1.31.0',
|
|
'version' => '1.31.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '0f68c03565dcaaf25a890667542e8bd75fe7e5bb',
|
|
),
|
|
'symfony/polyfill-php80' =>
|
|
array (
|
|
'pretty_version' => 'v1.31.0',
|
|
'version' => '1.31.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '60328e362d4c2c802a54fcbf04f9d3fb892b4cf8',
|
|
),
|
|
'symfony/psr-http-message-bridge' =>
|
|
array (
|
|
'pretty_version' => 'v2.3.1',
|
|
'version' => '2.3.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '581ca6067eb62640de5ff08ee1ba6850a0ee472e',
|
|
),
|
|
'symfony/service-contracts' =>
|
|
array (
|
|
'pretty_version' => 'v1.1.2',
|
|
'version' => '1.1.2.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '191afdcb5804db960d26d8566b7e9a2843cab3a0',
|
|
),
|
|
'symfony/var-exporter' =>
|
|
array (
|
|
'pretty_version' => 'v5.4.45',
|
|
'version' => '5.4.45.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '862700068db0ddfd8c5b850671e029a90246ec75',
|
|
),
|
|
'topthink/framework' =>
|
|
array (
|
|
'pretty_version' => 'dev-master',
|
|
'version' => 'dev-master',
|
|
'aliases' =>
|
|
array (
|
|
0 => '9999999-dev',
|
|
),
|
|
'reference' => 'c859e712f50362d8ee3a7cd2e495af5494847bef',
|
|
),
|
|
'topthink/think-captcha' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.9',
|
|
'version' => '1.0.9.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '9be9dd7e61c7fa3c478c4b92910d7230b94d0d23',
|
|
),
|
|
'topthink/think-helper' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.7',
|
|
'version' => '1.0.7.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '5f92178606c8ce131d36b37a57c58eb71e55f019',
|
|
),
|
|
'topthink/think-installer' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.14',
|
|
'version' => '1.0.14.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'eae1740ac264a55c06134b6685dfb9f837d004d1',
|
|
),
|
|
'topthink/think-queue' =>
|
|
array (
|
|
'pretty_version' => 'v1.1.6',
|
|
'version' => '1.1.6.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '250650eb0e8ea5af4cfdc7ae46f3f4e0a24ac245',
|
|
),
|
|
'txthinking/mailer' =>
|
|
array (
|
|
'pretty_version' => 'v2.0.1',
|
|
'version' => '2.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '09013cf9dad3aac195f66ae5309e8c3343c018e9',
|
|
),
|
|
),
|
|
);
|
|
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;
|
|
}
|
|
}
|
|
|