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, ), 'bshaffer/oauth2-server-php' => array ( 'pretty_version' => 'v1.11.1', 'version' => '1.11.1.0', 'aliases' => array ( ), 'reference' => '5a0c8000d4763b276919e2106f54eddda6bc50fa', ), 'ddeboer/imap' => array ( 'pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'aliases' => array ( ), 'reference' => 'a089dfcb9d177f921eb5dadc8d4144a44dff22ee', ), 'exorus/php-mime-mail-parser' => array ( 'replaced' => array ( 0 => '*', ), ), 'matthiasmullie/minify' => array ( 'pretty_version' => '1.3.65', 'version' => '1.3.65.0', 'aliases' => array ( ), 'reference' => '227f19062451c55a797e0cc667ef983834e6580c', ), 'matthiasmullie/path-converter' => array ( 'pretty_version' => '1.1.3', 'version' => '1.1.3.0', 'aliases' => array ( ), 'reference' => 'e7d13b2c7e2f2268e1424aaed02085518afa02d9', ), 'messaged/php-mime-mail-parser' => array ( 'replaced' => array ( 0 => '*', ), ), 'mustangostang/spyc' => array ( 'pretty_version' => '0.6.3', 'version' => '0.6.3.0', 'aliases' => array ( ), 'reference' => '4627c838b16550b666d15aeae1e5289dd5b77da0', ), 'paragonie/random_compat' => array ( 'pretty_version' => 'v9.99.100', 'version' => '9.99.100.0', 'aliases' => array ( ), 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', ), 'php-mime-mail-parser/php-mime-mail-parser' => array ( 'pretty_version' => '5.0.5', 'version' => '5.0.5.0', 'aliases' => array ( ), 'reference' => '27983433aabeccee832573c3c56e6a4855e57745', ), 'phpmailer/phpmailer' => array ( 'pretty_version' => 'v6.2.0', 'version' => '6.2.0.0', 'aliases' => array ( ), 'reference' => 'e38888a75c070304ca5514197d4847a59a5c853f', ), 'robthree/twofactorauth' => array ( 'pretty_version' => '1.7.0', 'version' => '1.7.0.0', 'aliases' => array ( ), 'reference' => '37983bf675c5baca09d19d6705170489d0df0002', ), 'soundasleep/html2text' => array ( 'pretty_version' => '0.5.0', 'version' => '0.5.0.0', 'aliases' => array ( ), 'reference' => 'cdb89f6ffa2c4cc78f8ed9ea6ee0594a9133ccad', ), 'yubico/u2flib-server' => array ( 'pretty_version' => '1.0.2', 'version' => '1.0.2.0', 'aliases' => array ( ), 'reference' => '55d813acf68212ad2cadecde07551600d6971939', ), ), ); public static function getInstalledPackages() { return array_keys(self::$installed['versions']); } public static function isInstalled($packageName) { return isset(self::$installed['versions'][$packageName]); } 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) { if (!isset(self::$installed['versions'][$packageName])) { throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } $ranges = array(); if (isset(self::$installed['versions'][$packageName]['pretty_version'])) { $ranges[] = self::$installed['versions'][$packageName]['pretty_version']; } if (array_key_exists('aliases', self::$installed['versions'][$packageName])) { $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']); } if (array_key_exists('replaced', self::$installed['versions'][$packageName])) { $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']); } if (array_key_exists('provided', self::$installed['versions'][$packageName])) { $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']); } return implode(' || ', $ranges); } public static function getVersion($packageName) { if (!isset(self::$installed['versions'][$packageName])) { throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } if (!isset(self::$installed['versions'][$packageName]['version'])) { return null; } return self::$installed['versions'][$packageName]['version']; } public static function getPrettyVersion($packageName) { if (!isset(self::$installed['versions'][$packageName])) { throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) { return null; } return self::$installed['versions'][$packageName]['pretty_version']; } public static function getReference($packageName) { if (!isset(self::$installed['versions'][$packageName])) { throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } if (!isset(self::$installed['versions'][$packageName]['reference'])) { return null; } return self::$installed['versions'][$packageName]['reference']; } public static function getRootPackage() { return self::$installed['root']; } public static function getRawData() { return self::$installed; } public static function reload($data) { self::$installed = $data; } }