array ( 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'aliases' => array ( ), 'reference' => '47ef4f9ec56cb1212b6ab717315bd88295d7d291', 'name' => 'codeigniter/framework', ), 'versions' => array ( 'chriskacerguis/codeigniter-restserver' => array ( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'aliases' => array ( 0 => '9999999-dev', ), 'reference' => '99d996275ebc323a00f35a4ab004f18c2f48be3d', ), 'codeigniter/framework' => array ( 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'aliases' => array ( ), 'reference' => '47ef4f9ec56cb1212b6ab717315bd88295d7d291', ), 'doctrine/instantiator' => array ( 'pretty_version' => '1.4.0', 'version' => '1.4.0.0', 'aliases' => array ( ), 'reference' => 'd56bf6102915de5702778fe20f2de3b2fe570b5b', ), 'mikey179/vfsstream' => array ( 'pretty_version' => 'v1.1.0', 'version' => '1.1.0.0', 'aliases' => array ( ), 'reference' => 'fc0fe8f4d0b527254a2dc45f0c265567c881d07e', ), 'myclabs/deep-copy' => array ( 'pretty_version' => '1.10.2', 'version' => '1.10.2.0', 'aliases' => array ( ), 'reference' => '776f831124e9c62e1a2c601ecc52e776d8bb7220', 'replaced' => array ( 0 => '1.10.2', ), ), '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', ), 'phpspec/prophecy' => array ( 'pretty_version' => 'v1.10.3', 'version' => '1.10.3.0', 'aliases' => array ( ), 'reference' => '451c3cd1418cf640de218914901e51b064abb093', ), 'phpunit/php-code-coverage' => array ( 'pretty_version' => '4.0.8', 'version' => '4.0.8.0', 'aliases' => array ( ), 'reference' => 'ef7b2f56815df854e66ceaee8ebe9393ae36a40d', ), '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' => '2.0.2', 'version' => '2.0.2.0', 'aliases' => array ( ), 'reference' => '791198a2c6254db10131eecfe8c06670700904db', ), 'phpunit/phpunit' => array ( 'pretty_version' => '5.7.27', 'version' => '5.7.27.0', 'aliases' => array ( ), 'reference' => 'b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c', ), 'phpunit/phpunit-mock-objects' => array ( 'pretty_version' => '3.4.4', 'version' => '3.4.4.0', 'aliases' => array ( ), 'reference' => 'a23b761686d50a560cc56233b9ecf49597cc9118', ), 'sebastian/code-unit-reverse-lookup' => array ( 'pretty_version' => '1.0.2', 'version' => '1.0.2.0', 'aliases' => array ( ), 'reference' => '1de8cd5c010cb153fcd68b8d0f64606f523f7619', ), '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' => '2.0.0', 'version' => '2.0.0.0', 'aliases' => array ( ), 'reference' => '5795ffe5dc5b02460c3e34222fee8cbe245d8fac', ), 'sebastian/exporter' => array ( 'pretty_version' => '2.0.0', 'version' => '2.0.0.0', 'aliases' => array ( ), 'reference' => 'ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4', ), 'sebastian/global-state' => array ( 'pretty_version' => '1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => 'bc37d50fea7d017d3d340f230811c9f1d7280af4', ), 'sebastian/object-enumerator' => array ( 'pretty_version' => '2.0.1', 'version' => '2.0.1.0', 'aliases' => array ( ), 'reference' => '1311872ac850040a79c3c058bea3e22d0f09cbb7', ), 'sebastian/recursion-context' => array ( 'pretty_version' => '2.0.0', 'version' => '2.0.0.0', 'aliases' => array ( ), 'reference' => '2c3ba150cbec723aa057506e73a8d33bdb286c9a', ), 'sebastian/resource-operations' => array ( 'pretty_version' => '1.0.0', 'version' => '1.0.0.0', 'aliases' => array ( ), 'reference' => 'ce990bb21759f94aeafd30209e8cfcdfa8bc3f52', ), 'sebastian/version' => array ( 'pretty_version' => '2.0.1', 'version' => '2.0.1.0', 'aliases' => array ( ), 'reference' => '99732be0ddb3361e16ad77b68ba41efc8e979019', ), 'symfony/polyfill-ctype' => array ( 'pretty_version' => 'v1.22.1', 'version' => '1.22.1.0', 'aliases' => array ( ), 'reference' => 'c6c942b1ac76c82448322025e084cadc56048b4e', ), 'symfony/yaml' => array ( 'pretty_version' => 'v4.4.21', 'version' => '4.4.21.0', 'aliases' => array ( ), 'reference' => '3871c720871029f008928244e56cf43497da7e9d', ), 'webmozart/assert' => array ( 'pretty_version' => '1.10.0', 'version' => '1.10.0.0', 'aliases' => array ( ), 'reference' => '6964c76c7804814a842473e0c8fd15bab0f18e25', ), ), ); 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; } }