array ( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', 'aliases' => array ( ), 'reference' => '9c8e559956fd2a6473d57c7b22168b40e2db59c8', 'name' => '__root__', ), 'versions' => array ( '__root__' => array ( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', 'aliases' => array ( ), 'reference' => '9c8e559956fd2a6473d57c7b22168b40e2db59c8', ), 'composer/ca-bundle' => array ( 'pretty_version' => '1.3.3', 'version' => '1.3.3.0', 'aliases' => array ( ), 'reference' => '30897edbfb15e784fe55587b4f73ceefd3c4d98c', ), 'dealerdirect/phpcodesniffer-composer-installer' => array ( 'pretty_version' => 'v0.7.2', 'version' => '0.7.2.0', 'aliases' => array ( ), 'reference' => '1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db', ), 'embed/embed' => array ( 'pretty_version' => 'v4.4.4', 'version' => '4.4.4.0', 'aliases' => array ( ), 'reference' => '52c2d77f58672868346ae09b0fa1eecc818bdf42', ), 'gettext/gettext' => array ( 'pretty_version' => 'v5.7.0', 'version' => '5.7.0.0', 'aliases' => array ( ), 'reference' => '8657e580747bb3baacccdcebe69cac094661e404', ), 'gettext/languages' => array ( 'pretty_version' => '2.9.0', 'version' => '2.9.0.0', 'aliases' => array ( ), 'reference' => 'ed56dd2c7f4024cc953ed180d25f02f2640e3ffa', ), 'gettext/translator' => array ( 'pretty_version' => 'v1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => 'b18ff33e8203de623854561f5e47e992fc5c50bb', ), 'grandel/include-directory' => array ( 'pretty_version' => 'v0.2.2', 'version' => '0.2.2.0', 'aliases' => array ( ), 'reference' => 'a5c830e8f1527c818b521ab18f2accecb02f9919', ), 'guzzlehttp/guzzle' => array ( 'pretty_version' => '7.4.5', 'version' => '7.4.5.0', 'aliases' => array ( ), 'reference' => '1dd98b0564cb3f6bd16ce683cb755f94c10fbd82', ), 'guzzlehttp/promises' => array ( 'pretty_version' => '1.5.1', 'version' => '1.5.1.0', 'aliases' => array ( ), 'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da', ), 'guzzlehttp/psr7' => array ( 'pretty_version' => '2.4.0', 'version' => '2.4.0.0', 'aliases' => array ( ), 'reference' => '13388f00956b1503577598873fffb5ae994b5737', ), 'ml/iri' => array ( 'pretty_version' => '1.1.4', 'version' => '1.1.4.0', 'aliases' => array ( ), 'reference' => 'cbd44fa913e00ea624241b38cefaa99da8d71341', ), 'ml/json-ld' => array ( 'pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'aliases' => array ( ), 'reference' => 'c74a1aed5979ed1cfb1be35a55a305fd30e30b93', ), 'oscarotero/html-parser' => array ( 'pretty_version' => 'v0.1.6', 'version' => '0.1.6.0', 'aliases' => array ( ), 'reference' => 'b61e92f634d0dc184339d24630a6968d3ac64ded', ), 'psr/http-client' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', ), 'psr/http-client-implementation' => array ( 'provided' => array ( 0 => '1.0', ), ), 'psr/http-factory' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', ), 'psr/http-factory-implementation' => array ( 'provided' => array ( 0 => '1.0', ), ), 'psr/http-message' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', ), 'psr/http-message-implementation' => array ( 'provided' => array ( 0 => '1.0', ), ), 'qferr/mjml-php' => array ( 'pretty_version' => '1.1.0', 'version' => '1.1.0.0', 'aliases' => array ( ), 'reference' => 'c6ea36c190e304e399a957f7e03b5a378faf41b9', ), 'ralouphie/getallheaders' => array ( 'pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'aliases' => array ( ), 'reference' => '120b605dfeb996808c31b6477290a714d356e822', ), 'squizlabs/php_codesniffer' => array ( 'pretty_version' => '3.7.1', 'version' => '3.7.1.0', 'aliases' => array ( ), 'reference' => '1359e176e9307e906dc3d890bcc9603ff6d90619', ), 'symfony/deprecation-contracts' => array ( 'pretty_version' => 'v3.1.1', 'version' => '3.1.1.0', 'aliases' => array ( ), 'reference' => '07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918', ), 'symfony/polyfill-php80' => array ( 'pretty_version' => 'v1.26.0', 'version' => '1.26.0.0', 'aliases' => array ( ), 'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace', ), 'symfony/process' => array ( 'pretty_version' => 'v5.4.11', 'version' => '5.4.11.0', 'aliases' => array ( ), 'reference' => '6e75fe6874cbc7e4773d049616ab450eff537bf1', ), 'wp-coding-standards/wpcs' => array ( 'pretty_version' => '2.3.0', 'version' => '2.3.0.0', 'aliases' => array ( ), 'reference' => '7da1894633f168fe244afc6de00d141f27517b62', ), ), ); 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; } }