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.
778 lines
16 KiB
778 lines
16 KiB
1 year ago
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
namespace Composer;
|
||
|
|
||
|
use Composer\Autoload\ClassLoader;
|
||
|
use Composer\Semver\VersionParser;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
class InstalledVersions
|
||
|
{
|
||
|
private static $installed = array (
|
||
|
'root' =>
|
||
|
array (
|
||
|
'pretty_version' => 'dev-master',
|
||
|
'version' => 'dev-master',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '8b86e4171769271cc35afa799854f287892f7216',
|
||
|
'name' => 'karsonzhang/fastadmin',
|
||
|
),
|
||
|
'versions' =>
|
||
|
array (
|
||
|
'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.16.0',
|
||
|
'version' => '4.16.0.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '523407fb06eb9e5f3d59889b3978d5bfe94299c8',
|
||
|
),
|
||
|
'guzzlehttp/guzzle' =>
|
||
|
array (
|
||
|
'pretty_version' => '7.8.0',
|
||
|
'version' => '7.8.0.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '1110f66a6530a40fe7aea0378fe608ee2b2248f9',
|
||
|
),
|
||
|
'guzzlehttp/promises' =>
|
||
|
array (
|
||
|
'pretty_version' => '2.0.1',
|
||
|
'version' => '2.0.1.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '111166291a0f8130081195ac4556a5587d7f1b5d',
|
||
|
),
|
||
|
'guzzlehttp/psr7' =>
|
||
|
array (
|
||
|
'pretty_version' => '2.6.1',
|
||
|
'version' => '2.6.1.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'be45764272e8873c72dbe3d2edcfdfcc3bc9f727',
|
||
|
),
|
||
|
'karsonzhang/fastadmin' =>
|
||
|
array (
|
||
|
'pretty_version' => 'dev-master',
|
||
|
'version' => 'dev-master',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '8b86e4171769271cc35afa799854f287892f7216',
|
||
|
),
|
||
|
'karsonzhang/fastadmin-addons' =>
|
||
|
array (
|
||
|
'pretty_version' => '1.3.3',
|
||
|
'version' => '1.3.3.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'f5bb4dabda55271b08371a8ae9355a205be48c56',
|
||
|
),
|
||
|
'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',
|
||
|
),
|
||
|
'monolog/monolog' =>
|
||
|
array (
|
||
|
'pretty_version' => '2.9.1',
|
||
|
'version' => '2.9.1.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'f259e2b15fb95494c83f52d3caad003bbf5ffaa1',
|
||
|
),
|
||
|
'myclabs/php-enum' =>
|
||
|
array (
|
||
|
'pretty_version' => '1.8.4',
|
||
|
'version' => '1.8.4.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
|
||
|
),
|
||
|
'nelexa/zip' =>
|
||
|
array (
|
||
|
'pretty_version' => '3.3.3',
|
||
|
'version' => '3.3.3.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '501b52f6fc393a599b44ff348a42740e1eaac7c6',
|
||
|
),
|
||
|
'overtrue/pinyin' =>
|
||
|
array (
|
||
|
'pretty_version' => '3.0.6',
|
||
|
'version' => '3.0.6.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '3b781d267197b74752daa32814d3a2cf5d140779',
|
||
|
),
|
||
|
'overtrue/socialite' =>
|
||
|
array (
|
||
|
'pretty_version' => '3.5.4',
|
||
|
'version' => '3.5.4.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '6bd4f0230bcaec5ccfd64a10581a9063233b5a48',
|
||
|
),
|
||
|
'overtrue/wechat' =>
|
||
|
array (
|
||
|
'pretty_version' => '5.30.0',
|
||
|
'version' => '5.30.0.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '245d1e821bc5a4609625c3244b111f570692cfc2',
|
||
|
),
|
||
|
'paragonie/random_compat' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v9.99.100',
|
||
|
'version' => '9.99.100.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
|
||
|
),
|
||
|
'phpoffice/phpspreadsheet' =>
|
||
|
array (
|
||
|
'pretty_version' => '1.19.0',
|
||
|
'version' => '1.19.0.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'a9ab55bfae02eecffb3df669a2e19ba0e2f04bbf',
|
||
|
),
|
||
|
'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-factory-implementation' =>
|
||
|
array (
|
||
|
'provided' =>
|
||
|
array (
|
||
|
0 => '1.0',
|
||
|
),
|
||
|
),
|
||
|
'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.29',
|
||
|
'version' => '5.4.29.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'e29c5a97bc2d81269973c3e1d7ceb9d48b4d5151',
|
||
|
),
|
||
|
'symfony/cache-contracts' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v2.5.2',
|
||
|
'version' => '2.5.2.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '64be4a7acb83b6f2bf6de9a02cee6dad41277ebc',
|
||
|
),
|
||
|
'symfony/cache-implementation' =>
|
||
|
array (
|
||
|
'provided' =>
|
||
|
array (
|
||
|
0 => '1.0|2.0',
|
||
|
),
|
||
|
),
|
||
|
'symfony/deprecation-contracts' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v2.5.2',
|
||
|
'version' => '2.5.2.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
|
||
|
),
|
||
|
'symfony/event-dispatcher' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v5.4.26',
|
||
|
'version' => '5.4.26.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '5dcc00e03413f05c1e7900090927bb7247cb0aac',
|
||
|
),
|
||
|
'symfony/event-dispatcher-contracts' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v2.5.2',
|
||
|
'version' => '2.5.2.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'f98b54df6ad059855739db6fcbc2d36995283fe1',
|
||
|
),
|
||
|
'symfony/event-dispatcher-implementation' =>
|
||
|
array (
|
||
|
'provided' =>
|
||
|
array (
|
||
|
0 => '2.0',
|
||
|
),
|
||
|
),
|
||
|
'symfony/finder' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v5.4.27',
|
||
|
'version' => '5.4.27.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'ff4bce3c33451e7ec778070e45bd23f74214cd5d',
|
||
|
),
|
||
|
'symfony/http-foundation' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v5.4.28',
|
||
|
'version' => '5.4.28.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '365992c83a836dfe635f1e903ccca43ee03d3dd2',
|
||
|
),
|
||
|
'symfony/polyfill-mbstring' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v1.28.0',
|
||
|
'version' => '1.28.0.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '42292d99c55abe617799667f454222c54c60e229',
|
||
|
),
|
||
|
'symfony/polyfill-php73' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v1.28.0',
|
||
|
'version' => '1.28.0.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => 'fe2f306d1d9d346a7fee353d0d5012e401e984b5',
|
||
|
),
|
||
|
'symfony/polyfill-php80' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v1.28.0',
|
||
|
'version' => '1.28.0.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '6caa57379c4aec19c0a12a38b59b26487dcfe4b5',
|
||
|
),
|
||
|
'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' => 'v4.4.43',
|
||
|
'version' => '4.4.43.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '4a7a3a3d55c471d396e6d28011368b7b83cb518b',
|
||
|
),
|
||
|
'topthink/framework' =>
|
||
|
array (
|
||
|
'pretty_version' => 'dev-master',
|
||
|
'version' => 'dev-master',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
0 => '9999999-dev',
|
||
|
),
|
||
|
'reference' => '096811899433eb0eb0988f1fe1db56ebb521bf34',
|
||
|
),
|
||
|
'topthink/think-captcha' =>
|
||
|
array (
|
||
|
'pretty_version' => 'v1.0.7',
|
||
|
'version' => '1.0.7.0',
|
||
|
'aliases' =>
|
||
|
array (
|
||
|
),
|
||
|
'reference' => '0c55455df26a1626a60d0dc35d2d89002b741d44',
|
||
|
),
|
||
|
'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;
|
||
|
}
|
||
|
}
|