-
-
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.
- Loading branch information
1 parent
25ac46b
commit 8870cb2
Showing
9 changed files
with
297 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,8 @@ | |
* | ||
* @author Fabien Potencier <[email protected]> | ||
* @author Jordi Boggiano <[email protected]> | ||
* @see http://www.php-fig.org/psr/psr-0/ | ||
* @see http://www.php-fig.org/psr/psr-4/ | ||
* @see https://www.php-fig.org/psr/psr-0/ | ||
* @see https://www.php-fig.org/psr/psr-4/ | ||
*/ | ||
class ClassLoader | ||
{ | ||
|
@@ -60,7 +60,7 @@ class ClassLoader | |
public function getPrefixes() | ||
{ | ||
if (!empty($this->prefixesPsr0)) { | ||
return call_user_func_array('array_merge', $this->prefixesPsr0); | ||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); | ||
} | ||
|
||
return array(); | ||
|
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,218 @@ | ||
<?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' => '25ac46be1a6301420d0d58a7c649bfdb1ca9c2e7', | ||
'name' => 'getkirby/kql', | ||
), | ||
'versions' => | ||
array ( | ||
'getkirby/composer-installer' => | ||
array ( | ||
'pretty_version' => '1.2.1', | ||
'version' => '1.2.1.0', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => 'c98ece30bfba45be7ce457e1102d1b169d922f3d', | ||
), | ||
'getkirby/kql' => | ||
array ( | ||
'pretty_version' => 'dev-master', | ||
'version' => 'dev-master', | ||
'aliases' => | ||
array ( | ||
), | ||
'reference' => '25ac46be1a6301420d0d58a7c649bfdb1ca9c2e7', | ||
), | ||
), | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
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
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.