1
0
Fork 0

Only allow platform packages to be overridden.

As defined by the PlatformRepository::PLATFORM_PACKAGE_REGEX pattern.
pull/2990/head
Joakim Israelsson 2014-05-14 20:37:24 +02:00
parent 571363dee2
commit ac89a5bb3b
1 changed files with 10 additions and 4 deletions

View File

@ -41,10 +41,16 @@ class PlatformRepository extends ArrayRepository
// Add each of the override versions as options.
// Later we might even replace the extensions instead.
foreach( $this->overrides as $name => $prettyVersion ) {
$version = $versionParser->normalize($prettyVersion);
$package = new CompletePackage($name, $version, $prettyVersion);
$package->setDescription("Overridden virtual platform package $name.");
parent::addPackage($package);
// Check that it's a platform package.
if( preg_match(self::PLATFORM_PACKAGE_REGEX, $name) ) {
$version = $versionParser->normalize($prettyVersion);
$package = new CompletePackage($name, $version, $prettyVersion);
$package->setDescription("Overridden virtual platform package $name.");
parent::addPackage($package);
}
else {
throw new \UnexpectedValueException('Invalid platform package "'.$name);
}
}