array ( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', 'aliases' => array ( ), 'reference' => 'b7996fda7a3b56432ef9e249584616d86d977517', 'name' => 'getgrav/grav-plugin-login', ), 'versions' => array ( 'bacon/bacon-qr-code' => array ( 'pretty_version' => '1.0.3', 'version' => '1.0.3.0', 'aliases' => array ( ), 'reference' => '5a91b62b9d37cee635bbf8d553f4546057250bee', ), 'birke/rememberme' => array ( 'pretty_version' => '1.0.5', 'version' => '1.0.5.0', 'aliases' => array ( ), 'reference' => '810473852eb4823098e47e23376a19b77ba0c165', ), 'getgrav/grav-plugin-login' => array ( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', 'aliases' => array ( ), 'reference' => 'b7996fda7a3b56432ef9e249584616d86d977517', ), 'paragonie/random_compat' => array ( 'pretty_version' => 'v1.4.3', 'version' => '1.4.3.0', 'aliases' => array ( ), 'reference' => '9b3899e3c3ddde89016f576edb8c489708ad64cd', ), 'robthree/twofactorauth' => array ( 'pretty_version' => '1.8.0', 'version' => '1.8.0.0', 'aliases' => array ( ), 'reference' => '30a38627ae1e7c9399dae67e265063cd6ec5276c', ), ), ); 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; } }