1
0
Fork 0

Add PlatformRepository::PLATFORM_PACKAGE_REGEX to remove duplication

pull/1647/merge
Jordi Boggiano 2013-04-06 22:26:10 +02:00
parent 370a9a40fc
commit d38eb244fa
3 changed files with 4 additions and 2 deletions

View File

@ -717,7 +717,7 @@ class Installer
private function extractPlatformRequirements($links) {
$platformReqs = array();
foreach ($links as $link) {
if (preg_match('{^(?:php(?:-64bit)?|(?:ext|lib)-[^/]+)$}i', $link->getTarget())) {
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
$platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
}
}

View File

@ -240,7 +240,7 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
}
// skip platform packages
if (preg_match('{^(?:php(?:-64bit)?|(?:ext|lib)-[^/]+)$}i', $name) || '__root__' === $name) {
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name) {
return array();
}

View File

@ -20,6 +20,8 @@ use Composer\Package\Version\VersionParser;
*/
class PlatformRepository extends ArrayRepository
{
const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit)?|(?:ext|lib)-[^/]+)$}i';
protected function initialize()
{
parent::initialize();