<?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' => '__root__',
  ),
  'versions' => 
  array (
    '__root__' => 
    array (
      'pretty_version' => '1.0.0+no-version-set',
      'version' => '1.0.0.0',
      'aliases' => 
      array (
      ),
      'reference' => NULL,
    ),
    'beste/clock' => 
    array (
      'pretty_version' => '3.0.0',
      'version' => '3.0.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '7004b55fcd54737b539886244b3a3b2188181974',
    ),
    'beste/in-memory-cache' => 
    array (
      'pretty_version' => '1.3.1',
      'version' => '1.3.1.0',
      'aliases' => 
      array (
      ),
      'reference' => 'f8299adc8abdaf7d309e8b28e53b4307ea49ebc7',
    ),
    'beste/json' => 
    array (
      'pretty_version' => '1.5.1',
      'version' => '1.5.1.0',
      'aliases' => 
      array (
      ),
      'reference' => '0e9a0dc74fa6d1bb4f9883ef64fa9f36b7b6b934',
    ),
    'brick/math' => 
    array (
      'pretty_version' => '0.12.3',
      'version' => '0.12.3.0',
      'aliases' => 
      array (
      ),
      'reference' => '866551da34e9a618e64a819ee1e01c20d8a588ba',
    ),
    'fig/http-message-util' => 
    array (
      'pretty_version' => '1.1.5',
      'version' => '1.1.5.0',
      'aliases' => 
      array (
      ),
      'reference' => '9d94dc0154230ac39e5bf89398b324a86f63f765',
    ),
    'firebase/php-jwt' => 
    array (
      'pretty_version' => 'v6.11.0',
      'version' => '6.11.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '8f718f4dfc9c5d5f0c994cdfd103921b43592712',
    ),
    'google/auth' => 
    array (
      'pretty_version' => 'v1.46.0',
      'version' => '1.46.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '7fafae99a41984cbfb92508174263cf7bf3049b9',
    ),
    'google/cloud-core' => 
    array (
      'pretty_version' => 'v1.62.1',
      'version' => '1.62.1.0',
      'aliases' => 
      array (
      ),
      'reference' => '824a617d5c2b1b571673d1111856f5c2f064a0fd',
    ),
    'google/cloud-storage' => 
    array (
      'pretty_version' => 'v1.47.0',
      'version' => '1.47.0.0',
      'aliases' => 
      array (
      ),
      'reference' => 'c8f130fab6a48dad9c486e93a07cd26123d006bb',
    ),
    'google/common-protos' => 
    array (
      'pretty_version' => '4.11.0',
      'version' => '4.11.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '2554ed1f09aa20faae7b71b590e7063df97ff670',
    ),
    'google/gax' => 
    array (
      'pretty_version' => 'v1.36.0',
      'version' => '1.36.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '140599cf5eae2432363ce6198e9fdff851625a7a',
    ),
    'google/grpc-gcp' => 
    array (
      'pretty_version' => 'v0.4.1',
      'version' => '0.4.1.0',
      'aliases' => 
      array (
      ),
      'reference' => 'e585b7721bbe806ef45b5c52ae43dfc2bff89968',
    ),
    'google/longrunning' => 
    array (
      'pretty_version' => '0.4.7',
      'version' => '0.4.7.0',
      'aliases' => 
      array (
      ),
      'reference' => '624cabb874c10e5ddc9034c999f724894b70a3d3',
    ),
    'google/protobuf' => 
    array (
      'pretty_version' => 'v4.30.2',
      'version' => '4.30.2.0',
      'aliases' => 
      array (
      ),
      'reference' => 'a4c4d8565b40b9f76debc9dfeb221412eacb8ced',
    ),
    'grpc/grpc' => 
    array (
      'pretty_version' => '1.57.0',
      'version' => '1.57.0.0',
      'aliases' => 
      array (
      ),
      'reference' => 'b610c42022ed3a22f831439cb93802f2a4502fdf',
    ),
    'guzzlehttp/guzzle' => 
    array (
      'pretty_version' => '7.9.3',
      'version' => '7.9.3.0',
      'aliases' => 
      array (
      ),
      'reference' => '7b2f29fe81dc4da0ca0ea7d42107a0845946ea77',
    ),
    'guzzlehttp/promises' => 
    array (
      'pretty_version' => '2.2.0',
      'version' => '2.2.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '7c69f28996b0a6920945dd20b3857e499d9ca96c',
    ),
    'guzzlehttp/psr7' => 
    array (
      'pretty_version' => '2.7.1',
      'version' => '2.7.1.0',
      'aliases' => 
      array (
      ),
      'reference' => 'c2270caaabe631b3b44c85f99e5a04bbb8060d16',
    ),
    'kreait/firebase-php' => 
    array (
      'pretty_version' => '7.18.0',
      'version' => '7.18.0.0',
      'aliases' => 
      array (
      ),
      'reference' => 'f43bc2509721ae2bff77f5232e5f56225440393b',
    ),
    'kreait/firebase-tokens' => 
    array (
      'pretty_version' => '5.2.1',
      'version' => '5.2.1.0',
      'aliases' => 
      array (
      ),
      'reference' => 'df6f9d153f3bbe671c3247576d2a45cbd0a79620',
    ),
    'lcobucci/jwt' => 
    array (
      'pretty_version' => '5.3.0',
      'version' => '5.3.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '08071d8d2c7f4b00222cc4b1fb6aa46990a80f83',
    ),
    'monolog/monolog' => 
    array (
      'pretty_version' => '3.9.0',
      'version' => '3.9.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '10d85740180ecba7896c87e06a166e0c95a0e3b6',
    ),
    'mtdowling/jmespath.php' => 
    array (
      'pretty_version' => '2.8.0',
      'version' => '2.8.0.0',
      'aliases' => 
      array (
      ),
      'reference' => 'a2a865e05d5f420b50cc2f85bb78d565db12a6bc',
    ),
    'psr/cache' => 
    array (
      'pretty_version' => '3.0.0',
      'version' => '3.0.0.0',
      'aliases' => 
      array (
      ),
      'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
    ),
    'psr/cache-implementation' => 
    array (
      'provided' => 
      array (
        0 => '2.0 || 3.0',
      ),
    ),
    '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/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.1.0',
      'version' => '1.1.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
    ),
    'psr/http-factory-implementation' => 
    array (
      'provided' => 
      array (
        0 => '1.0',
      ),
    ),
    'psr/http-message' => 
    array (
      'pretty_version' => '2.0',
      'version' => '2.0.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
    ),
    'psr/http-message-implementation' => 
    array (
      'provided' => 
      array (
        0 => '1.0',
      ),
    ),
    'psr/log' => 
    array (
      'pretty_version' => '3.0.2',
      'version' => '3.0.2.0',
      'aliases' => 
      array (
      ),
      'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
    ),
    'psr/log-implementation' => 
    array (
      'provided' => 
      array (
        0 => '3.0.0',
      ),
    ),
    'ralouphie/getallheaders' => 
    array (
      'pretty_version' => '3.0.3',
      'version' => '3.0.3.0',
      'aliases' => 
      array (
      ),
      'reference' => '120b605dfeb996808c31b6477290a714d356e822',
    ),
    'ramsey/collection' => 
    array (
      'pretty_version' => '2.1.1',
      'version' => '2.1.1.0',
      'aliases' => 
      array (
      ),
      'reference' => '344572933ad0181accbf4ba763e85a0306a8c5e2',
    ),
    'ramsey/uuid' => 
    array (
      'pretty_version' => '4.7.6',
      'version' => '4.7.6.0',
      'aliases' => 
      array (
      ),
      'reference' => '91039bc1faa45ba123c4328958e620d382ec7088',
    ),
    'rhumsaa/uuid' => 
    array (
      'replaced' => 
      array (
        0 => '4.7.6',
      ),
    ),
    'rize/uri-template' => 
    array (
      'pretty_version' => '0.4.0',
      'version' => '0.4.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '56f374a9a42c7c3998f8b55b6b21b224de90c58b',
    ),
    'symfony/deprecation-contracts' => 
    array (
      'pretty_version' => 'v3.5.1',
      'version' => '3.5.1.0',
      'aliases' => 
      array (
      ),
      'reference' => '74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6',
    ),
    'symfony/polyfill-mbstring' => 
    array (
      'pretty_version' => 'v1.31.0',
      'version' => '1.31.0.0',
      'aliases' => 
      array (
      ),
      'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341',
    ),
  ),
);
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;
}
}
