-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from tbela99/v.next
#121 missing composer files
- Loading branch information
Showing
3 changed files
with
305 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
<?php | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
namespace Composer; | ||
|
||
use Composer\Semver\VersionParser; | ||
|
||
|
||
|
||
|
||
|
||
|
||
class InstalledVersions | ||
{ | ||
private static $installed = array ( | ||
'root' => | ||
array ( | ||
'pretty_version' => 'dev-master', | ||
'version' => 'dev-master', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => 'd6b059a9c35d2138a99c225a5b64fdec0fc0d89d', | ||
'name' => '__root__', | ||
), | ||
'versions' => | ||
array ( | ||
'__root__' => | ||
array ( | ||
'pretty_version' => 'dev-master', | ||
'version' => 'dev-master', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => 'd6b059a9c35d2138a99c225a5b64fdec0fc0d89d', | ||
), | ||
'lordelph/icofileloader' => | ||
array ( | ||
'pretty_version' => '2.0.1', | ||
'version' => '2.0.1.0', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '97fa83f23d3b155b08923629377a8a34327f6930', | ||
), | ||
'tbela99/css' => | ||
array ( | ||
'pretty_version' => 'dev-php56-backport', | ||
'version' => 'dev-php56-backport', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '144c4b7e7c92d80ceece0710be9b635eb98ef2c4', | ||
), | ||
), | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
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,42 @@ | ||
<?php return array ( | ||
'root' => | ||
array ( | ||
'pretty_version' => 'dev-master', | ||
'version' => 'dev-master', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => 'd6b059a9c35d2138a99c225a5b64fdec0fc0d89d', | ||
'name' => '__root__', | ||
), | ||
'versions' => | ||
array ( | ||
'__root__' => | ||
array ( | ||
'pretty_version' => 'dev-master', | ||
'version' => 'dev-master', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => 'd6b059a9c35d2138a99c225a5b64fdec0fc0d89d', | ||
), | ||
'lordelph/icofileloader' => | ||
array ( | ||
'pretty_version' => '2.0.1', | ||
'version' => '2.0.1.0', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '97fa83f23d3b155b08923629377a8a34327f6930', | ||
), | ||
'tbela99/css' => | ||
array ( | ||
'pretty_version' => 'dev-php56-backport', | ||
'version' => 'dev-php56-backport', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '144c4b7e7c92d80ceece0710be9b635eb98ef2c4', | ||
), | ||
), | ||
); |
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,26 @@ | ||
<?php | ||
|
||
// platform_check.php @generated by Composer | ||
|
||
$issues = array(); | ||
|
||
if (!(PHP_VERSION_ID >= 50600)) { | ||
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; | ||
} | ||
|
||
if ($issues) { | ||
if (!headers_sent()) { | ||
header('HTTP/1.1 500 Internal Server Error'); | ||
} | ||
if (!ini_get('display_errors')) { | ||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { | ||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); | ||
} elseif (!headers_sent()) { | ||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; | ||
} | ||
} | ||
trigger_error( | ||
'Composer detected issues in your platform: ' . implode(' ', $issues), | ||
E_USER_ERROR | ||
); | ||
} |