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.
wkcrm/vendor/composer/InstalledVersions.php

680 lines
14 KiB

4 years 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' => '7088f600d8002ab34d9457e48bfdaf2050cebf68',
'name' => 'topthink/think',
),
'versions' =>
array (
'doctrine/instantiator' =>
array (
'pretty_version' => '1.4.0',
'version' => '1.4.0.0',
'aliases' =>
array (
),
'reference' => 'd56bf6102915de5702778fe20f2de3b2fe570b5b',
),
'markbaker/complex' =>
array (
'pretty_version' => '1.5.0',
'version' => '1.5.0.0',
'aliases' =>
array (
),
'reference' => 'c3131244e29c08d44fefb49e0dd35021e9e39dd2',
),
'markbaker/matrix' =>
array (
'pretty_version' => '1.2.3',
'version' => '1.2.3.0',
'aliases' =>
array (
),
'reference' => '44bb1ab01811116f01fe216ab37d921dccc6c10d',
),
'pclzip/pclzip' =>
array (
'pretty_version' => '2.8.2',
'version' => '2.8.2.0',
'aliases' =>
array (
),
'reference' => '19dd1de9d3f5fc4d7d70175b4c344dee329f45fd',
),
'phpdocumentor/reflection-common' =>
array (
'pretty_version' => '2.2.0',
'version' => '2.2.0.0',
'aliases' =>
array (
),
'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b',
),
'phpdocumentor/reflection-docblock' =>
array (
'pretty_version' => '5.2.2',
'version' => '5.2.2.0',
'aliases' =>
array (
),
'reference' => '069a785b2141f5bcf49f3e353548dc1cce6df556',
),
'phpdocumentor/type-resolver' =>
array (
'pretty_version' => '1.4.0',
'version' => '1.4.0.0',
'aliases' =>
array (
),
'reference' => '6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0',
),
'phpoffice/common' =>
array (
'pretty_version' => '0.2.9',
'version' => '0.2.9.0',
'aliases' =>
array (
),
'reference' => 'edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d',
),
'phpoffice/phpexcel' =>
array (
'pretty_version' => '1.8.0',
'version' => '1.8.0.0',
'aliases' =>
array (
),
'reference' => 'e69a5e4d0ffa7fb6f171859e0a04346e580df30b',
),
'phpoffice/phpspreadsheet' =>
array (
'pretty_version' => '1.8.0',
'version' => '1.8.0.0',
'aliases' =>
array (
),
'reference' => '0e6238c69e863b58aeece61e48ea032696c6dccd',
),
'phpoffice/phpword' =>
array (
'pretty_version' => '0.17.0',
'version' => '0.17.0.0',
'aliases' =>
array (
),
'reference' => 'b8346af548d399acd9e30fc76ab0c55c2fec03a5',
),
'phpspec/prophecy' =>
array (
'pretty_version' => 'v1.10.3',
'version' => '1.10.3.0',
'aliases' =>
array (
),
'reference' => '451c3cd1418cf640de218914901e51b064abb093',
),
'phpunit/php-code-coverage' =>
array (
'pretty_version' => '2.2.4',
'version' => '2.2.4.0',
'aliases' =>
array (
),
'reference' => 'eabf68b476ac7d0f73793aada060f1c1a9bf8979',
),
'phpunit/php-file-iterator' =>
array (
'pretty_version' => '1.4.5',
'version' => '1.4.5.0',
'aliases' =>
array (
),
'reference' => '730b01bc3e867237eaac355e06a36b85dd93a8b4',
),
'phpunit/php-text-template' =>
array (
'pretty_version' => '1.2.1',
'version' => '1.2.1.0',
'aliases' =>
array (
),
'reference' => '31f8b717e51d9a2afca6c9f046f5d69fc27c8686',
),
'phpunit/php-timer' =>
array (
'pretty_version' => '1.0.9',
'version' => '1.0.9.0',
'aliases' =>
array (
),
'reference' => '3dcf38ca72b158baf0bc245e9184d3fdffa9c46f',
),
'phpunit/php-token-stream' =>
array (
'pretty_version' => '1.4.12',
'version' => '1.4.12.0',
'aliases' =>
array (
),
'reference' => '1ce90ba27c42e4e44e6d8458241466380b51fa16',
),
'phpunit/phpunit' =>
array (
'pretty_version' => '4.8.36',
'version' => '4.8.36.0',
'aliases' =>
array (
),
'reference' => '46023de9a91eec7dfb06cc56cb4e260017298517',
),
'phpunit/phpunit-mock-objects' =>
array (
'pretty_version' => '2.3.8',
'version' => '2.3.8.0',
'aliases' =>
array (
),
'reference' => 'ac8e7a3db35738d56ee9a76e78a4e03d97628983',
),
'psr/simple-cache' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
),
'sebastian/comparator' =>
array (
'pretty_version' => '1.2.4',
'version' => '1.2.4.0',
'aliases' =>
array (
),
'reference' => '2b7424b55f5047b47ac6e5ccb20b2aea4011d9be',
),
'sebastian/diff' =>
array (
'pretty_version' => '1.4.3',
'version' => '1.4.3.0',
'aliases' =>
array (
),
'reference' => '7f066a26a962dbe58ddea9f72a4e82874a3975a4',
),
'sebastian/environment' =>
array (
'pretty_version' => '1.3.8',
'version' => '1.3.8.0',
'aliases' =>
array (
),
'reference' => 'be2c607e43ce4c89ecd60e75c6a85c126e754aea',
),
'sebastian/exporter' =>
array (
'pretty_version' => '1.2.2',
'version' => '1.2.2.0',
'aliases' =>
array (
),
'reference' => '42c4c2eec485ee3e159ec9884f95b431287edde4',
),
'sebastian/global-state' =>
array (
'pretty_version' => '1.1.1',
'version' => '1.1.1.0',
'aliases' =>
array (
),
'reference' => 'bc37d50fea7d017d3d340f230811c9f1d7280af4',
),
'sebastian/recursion-context' =>
array (
'pretty_version' => '1.0.5',
'version' => '1.0.5.0',
'aliases' =>
array (
),
'reference' => 'b19cc3298482a335a95f3016d2f8a6950f0fbcd7',
),
'sebastian/version' =>
array (
'pretty_version' => '1.0.6',
'version' => '1.0.6.0',
'aliases' =>
array (
),
'reference' => '58b3a85e7999757d6ad81c787a1fbf5ff6c628c6',
),
'symfony/dom-crawler' =>
array (
'pretty_version' => 'v2.8.52',
'version' => '2.8.52.0',
'aliases' =>
array (
),
'reference' => '2cdc7d3909eea6f982a6298d2e9ab7db01b6403c',
),
'symfony/polyfill-ctype' =>
array (
'pretty_version' => 'v1.22.1',
'version' => '1.22.1.0',
'aliases' =>
array (
),
'reference' => 'c6c942b1ac76c82448322025e084cadc56048b4e',
),
'symfony/polyfill-mbstring' =>
array (
'pretty_version' => 'v1.22.1',
'version' => '1.22.1.0',
'aliases' =>
array (
),
'reference' => '5232de97ee3b75b0360528dae24e73db49566ab1',
),
'symfony/yaml' =>
array (
'pretty_version' => 'v3.4.47',
'version' => '3.4.47.0',
'aliases' =>
array (
),
'reference' => '88289caa3c166321883f67fe5130188ebbb47094',
),
'topthink/framework' =>
array (
'pretty_version' => 'v5.0.24',
'version' => '5.0.24.0',
'aliases' =>
array (
),
'reference' => 'c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be',
),
'topthink/think' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '7088f600d8002ab34d9457e48bfdaf2050cebf68',
),
'topthink/think-helper' =>
array (
'pretty_version' => 'v1.0.7',
'version' => '1.0.7.0',
'aliases' =>
array (
),
'reference' => '5f92178606c8ce131d36b37a57c58eb71e55f019',
),
'topthink/think-image' =>
array (
'pretty_version' => 'v1.0.7',
'version' => '1.0.7.0',
'aliases' =>
array (
),
'reference' => '8586cf47f117481c6d415b20f7dedf62e79d5512',
),
'topthink/think-installer' =>
array (
'pretty_version' => 'v1.0.14',
'version' => '1.0.14.0',
'aliases' =>
array (
),
'reference' => 'eae1740ac264a55c06134b6685dfb9f837d004d1',
),
'topthink/think-migration' =>
array (
'pretty_version' => 'v1.1.1',
'version' => '1.1.1.0',
'aliases' =>
array (
),
'reference' => '8e489f8d38a39876690c0e00fcf9a54ae92c4d3d',
),
'topthink/think-mongo' =>
array (
'pretty_version' => 'v1.8.5',
'version' => '1.8.5.0',
'aliases' =>
array (
),
'reference' => '657cc79bd5f090a58b0cc83776073dd69c83a3d1',
),
'topthink/think-queue' =>
array (
'pretty_version' => 'v1.1.6',
'version' => '1.1.6.0',
'aliases' =>
array (
),
'reference' => '250650eb0e8ea5af4cfdc7ae46f3f4e0a24ac245',
),
'topthink/think-sae' =>
array (
'pretty_version' => 'v1.1',
'version' => '1.1.0.0',
'aliases' =>
array (
),
'reference' => 'e31ee4ec073c0ffc5dbc7292f8268661e5265091',
),
'topthink/think-testing' =>
array (
'pretty_version' => 'v1.0.6',
'version' => '1.0.6.0',
'aliases' =>
array (
),
'reference' => 'e89794e5c58aa5587f7b08038e9468150870b185',
),
'topthink/think-worker' =>
array (
'pretty_version' => 'v1.0.0',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => 'f48ca8e5d8324aace15cdbf0f3de751397ef803f',
),
'webmozart/assert' =>
array (
'pretty_version' => '1.10.0',
'version' => '1.10.0.0',
'aliases' =>
array (
),
'reference' => '6964c76c7804814a842473e0c8fd15bab0f18e25',
),
'workerman/workerman' =>
array (
'pretty_version' => 'v3.5.31',
'version' => '3.5.31.0',
'aliases' =>
array (
),
'reference' => 'b73ddc45b3c7299f330923a2bde23ca6e974fd96',
),
'zendframework/zend-escaper' =>
array (
'pretty_version' => '2.6.1',
'version' => '2.6.1.0',
'aliases' =>
array (
),
'reference' => '3801caa21b0ca6aca57fa1c42b08d35c395ebd5f',
),
),
);
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()
{
return self::$installed;
}
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;
}
}