array ( 'pretty_version' => '1.25.x-dev', 'version' => '1.25.9999999.9999999-dev', 'aliases' => array ( ), 'reference' => 'e1d6dd02e975fb270ebff01372a934b172dfefbd', 'name' => 'combostrap/combo', ), 'versions' => array ( 'antlr/antlr4-php-runtime' => array ( 'pretty_version' => '0.5.1', 'version' => '0.5.1.0', 'aliases' => array ( ), 'reference' => '73790bc994cec4b18a414865234ab0db198b065d', ), 'carica/phpcss' => array ( 'pretty_version' => '2.0.0', 'version' => '2.0.0.0', 'aliases' => array ( ), 'reference' => '944cdd0cf21655ceb1bd3262dee9b33602020c09', ), 'combostrap/combo' => array ( 'pretty_version' => '1.25.x-dev', 'version' => '1.25.9999999.9999999-dev', 'aliases' => array ( ), 'reference' => 'e1d6dd02e975fb270ebff01372a934b172dfefbd', ), 'dragonmantank/cron-expression' => array ( 'pretty_version' => 'v1.2.1', 'version' => '1.2.1.0', 'aliases' => array ( ), 'reference' => '9504fa9ea681b586028adaaa0877db4aecf32bad', ), 'facebook/webdriver' => array ( 'replaced' => array ( 0 => '*', ), ), 'hidehalo/nanoid-php' => array ( 'pretty_version' => '1.1.8', 'version' => '1.1.8.0', 'aliases' => array ( ), 'reference' => '14187ab7a5affa34078b6a54df94176bb7a21227', ), 'paragonie/random_compat' => array ( 'pretty_version' => 'v9.99.100', 'version' => '9.99.100.0', 'aliases' => array ( ), 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', ), 'php-webdriver/webdriver' => array ( 'pretty_version' => '1.12.1', 'version' => '1.12.1.0', 'aliases' => array ( ), 'reference' => 'b27ddf458d273c7d4602106fcaf978aa0b7fe15a', ), 'salesforce/handlebars-php' => array ( 'pretty_version' => '3.0.1', 'version' => '3.0.1.0', 'aliases' => array ( ), 'reference' => 'd3a0552d85472249617ef6b56197c844d62d2ac3', ), 'symfony/deprecation-contracts' => array ( 'pretty_version' => 'v2.5.2', 'version' => '2.5.2.0', 'aliases' => array ( ), 'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66', ), 'symfony/polyfill-ctype' => array ( 'pretty_version' => 'v1.27.0', 'version' => '1.27.0.0', 'aliases' => array ( ), 'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a', ), 'symfony/polyfill-mbstring' => array ( 'pretty_version' => 'v1.25.0', 'version' => '1.25.0.0', 'aliases' => array ( ), 'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825', ), 'symfony/polyfill-php80' => array ( 'pretty_version' => 'v1.25.0', 'version' => '1.25.0.0', 'aliases' => array ( ), 'reference' => '4407588e0d3f1f52efb65fbe92babe41f37fe50c', ), 'symfony/process' => array ( 'pretty_version' => 'v5.4.8', 'version' => '5.4.8.0', 'aliases' => array ( ), 'reference' => '597f3fff8e3e91836bb0bd38f5718b56ddbde2f3', ), 'symfony/yaml' => array ( 'pretty_version' => 'v5.4.21', 'version' => '5.4.21.0', 'aliases' => array ( ), 'reference' => '3713e20d93e46e681e51605d213027e48dab3469', ), ), ); 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; } }