426 lines
8.5 KiB
PHP
426 lines
8.5 KiB
PHP
<?php
|
|
|
|
namespace Composer;
|
|
|
|
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' => 'taoser/taoler',
|
|
),
|
|
'versions' =>
|
|
array (
|
|
'firebase/php-jwt' =>
|
|
array (
|
|
'pretty_version' => 'v5.2.0',
|
|
'version' => '5.2.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'feb0e820b8436873675fd3aca04f3728eb2185cb',
|
|
),
|
|
'league/flysystem' =>
|
|
array (
|
|
'pretty_version' => '1.1.3',
|
|
'version' => '1.1.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '9be3b16c877d477357c015cec057548cf9b2a14a',
|
|
),
|
|
'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.7.0',
|
|
'version' => '1.7.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3',
|
|
),
|
|
'lotofbadcode/phpspirit_databackup' =>
|
|
array (
|
|
'pretty_version' => 'v1.1',
|
|
'version' => '1.1.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '2627b2e4206031731c94c8d637fb06b3b96e8860',
|
|
),
|
|
'phpmailer/phpmailer' =>
|
|
array (
|
|
'pretty_version' => 'v6.2.0',
|
|
'version' => '6.2.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'e38888a75c070304ca5514197d4847a59a5c853f',
|
|
),
|
|
'psr/cache' =>
|
|
array (
|
|
'pretty_version' => '1.0.1',
|
|
'version' => '1.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
|
|
),
|
|
'psr/container' =>
|
|
array (
|
|
'pretty_version' => '1.0.0',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
|
|
),
|
|
'psr/log' =>
|
|
array (
|
|
'pretty_version' => '1.1.3',
|
|
'version' => '1.1.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc',
|
|
),
|
|
'psr/simple-cache' =>
|
|
array (
|
|
'pretty_version' => '1.0.1',
|
|
'version' => '1.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
|
|
),
|
|
'symfony/polyfill-mbstring' =>
|
|
array (
|
|
'pretty_version' => 'v1.22.0',
|
|
'version' => '1.22.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'f377a3dd1fde44d37b9831d68dc8dea3ffd28e13',
|
|
),
|
|
'symfony/polyfill-php72' =>
|
|
array (
|
|
'pretty_version' => 'v1.22.0',
|
|
'version' => '1.22.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9',
|
|
),
|
|
'symfony/polyfill-php80' =>
|
|
array (
|
|
'pretty_version' => 'v1.22.0',
|
|
'version' => '1.22.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'dc3063ba22c2a1fd2f45ed856374d79114998f91',
|
|
),
|
|
'symfony/var-dumper' =>
|
|
array (
|
|
'pretty_version' => 'v4.4.19',
|
|
'version' => '4.4.19.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'a1eab2f69906dc83c5ddba4632180260d0ab4f7f',
|
|
),
|
|
'taoser/taoler' =>
|
|
array (
|
|
'pretty_version' => '1.0.0+no-version-set',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => NULL,
|
|
),
|
|
'taoser/think-auth' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.0',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '19bb04e4fb957a95ff3fdc142939922c19167b43',
|
|
),
|
|
'topthink/framework' =>
|
|
array (
|
|
'pretty_version' => 'v6.0.7',
|
|
'version' => '6.0.7.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'db8fe22520a9660dd5e4c87e304034ac49e39270',
|
|
),
|
|
'topthink/think-captcha' =>
|
|
array (
|
|
'pretty_version' => 'v3.0.3',
|
|
'version' => '3.0.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '1eef3717c1bcf4f5bbe2d1a1c704011d330a8b55',
|
|
),
|
|
'topthink/think-helper' =>
|
|
array (
|
|
'pretty_version' => 'v3.1.4',
|
|
'version' => '3.1.4.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'c28d37743bda4a0455286ca85b17b5791d626e10',
|
|
),
|
|
'topthink/think-multi-app' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.14',
|
|
'version' => '1.0.14.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3',
|
|
),
|
|
'topthink/think-orm' =>
|
|
array (
|
|
'pretty_version' => 'v2.0.36',
|
|
'version' => '2.0.36.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'f48dc09050f25029d41a66bfc9c3c403e4f82024',
|
|
),
|
|
'topthink/think-template' =>
|
|
array (
|
|
'pretty_version' => 'v2.0.8',
|
|
'version' => '2.0.8.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'abfc293f74f9ef5127b5c416310a01fe42e59368',
|
|
),
|
|
'topthink/think-trace' =>
|
|
array (
|
|
'pretty_version' => 'v1.4',
|
|
'version' => '1.4.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '9a9fa8f767b6c66c5a133ad21ca1bc96ad329444',
|
|
),
|
|
'topthink/think-view' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.14',
|
|
'version' => '1.0.14.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'edce0ae2c9551ab65f9e94a222604b0dead3576d',
|
|
),
|
|
'zzstudio/think-addons' =>
|
|
array (
|
|
'pretty_version' => '2.0.5',
|
|
'version' => '2.0.5.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '7eb740cb219a111d593a05ad88248a74f640fe5c',
|
|
),
|
|
),
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getInstalledPackages()
|
|
{
|
|
return array_keys(self::$installed['versions']);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function isInstalled($packageName)
|
|
{
|
|
return isset(self::$installed['versions'][$packageName]);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
$ranges = array();
|
|
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
|
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
|
}
|
|
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
|
}
|
|
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
|
}
|
|
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
|
}
|
|
|
|
return implode(' || ', $ranges);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getVersion($packageName)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
|
return null;
|
|
}
|
|
|
|
return self::$installed['versions'][$packageName]['version'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getPrettyVersion($packageName)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
|
return null;
|
|
}
|
|
|
|
return self::$installed['versions'][$packageName]['pretty_version'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getReference($packageName)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
|
return null;
|
|
}
|
|
|
|
return self::$installed['versions'][$packageName]['reference'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getRootPackage()
|
|
{
|
|
return self::$installed['root'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getRawData()
|
|
{
|
|
return self::$installed;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function reload($data)
|
|
{
|
|
self::$installed = $data;
|
|
}
|
|
}
|