-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
358 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
<?php | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
namespace Composer; | ||
|
||
use Composer\Semver\VersionParser; | ||
|
||
|
||
|
||
|
||
|
||
|
||
class InstalledVersions | ||
{ | ||
private static $installed = array ( | ||
'root' => | ||
array ( | ||
'pretty_version' => '2.7.2.x-dev', | ||
'version' => '2.7.2.9999999-dev', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '638a172c185dac9652568aeb8bf4675aab0fdfd5', | ||
'name' => '__root__', | ||
), | ||
'versions' => | ||
array ( | ||
'__root__' => | ||
array ( | ||
'pretty_version' => '2.7.2.x-dev', | ||
'version' => '2.7.2.9999999-dev', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '638a172c185dac9652568aeb8bf4675aab0fdfd5', | ||
), | ||
'espresso-dev/instagram-basic-display-php' => | ||
array ( | ||
'pretty_version' => 'v1.1.4', | ||
'version' => '1.1.4.0', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '8b9ac7a7bd3dca6c3a31ca66afe5508e0eae9f28', | ||
), | ||
), | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
// autoload_files.php @generated by Composer | ||
|
||
$vendorDir = dirname(dirname(__FILE__)); | ||
$baseDir = dirname($vendorDir); | ||
|
||
return array( | ||
'6df4ba8aa0eb44690143d69c920df9e0' => $baseDir . '/src/schedule.php', | ||
'dd9ebc777b0f370dc67051f78ae35b7e' => $baseDir . '/src/shortcode.php', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.