Browse Source

Make package names and downloader/installer/repository types case insensitive

Igor Wiedler 13 years ago
parent
commit
9e8fc71870

+ 4 - 0
src/Composer/Composer.php

@@ -33,11 +33,13 @@ class Composer
 
     public function addDownloader($type, $downloader)
     {
+        $type = strtolower($type);
         $this->downloaders[$type] = $downloader;
     }
 
     public function getDownloader($type)
     {
+        $type = strtolower($type);
         if (!isset($this->downloaders[$type])) {
             throw new \UnexpectedValueException('Unknown source type: '.$type);
         }
@@ -46,11 +48,13 @@ class Composer
 
     public function addInstaller($type, $installer)
     {
+        $type = strtolower($type);
         $this->installers[$type] = $installer;
     }
 
     public function getInstaller($type)
     {
+        $type = strtolower($type);
         if (!isset($this->installers[$type])) {
             throw new \UnexpectedValueException('Unknown dependency type: '.$type);
         }

+ 1 - 1
src/Composer/Package/BasePackage.php

@@ -34,7 +34,7 @@ abstract class BasePackage implements PackageInterface
      */
     public function __construct($name)
     {
-        $this->name = $name;
+        $this->name = strtolower($name);
         $this->id = -1;
     }
 

+ 2 - 2
src/Composer/Package/Link.php

@@ -36,8 +36,8 @@ class Link
      */
     public function __construct($source, $target, LinkConstraintInterface $constraint = null, $description = 'relates to')
     {
-        $this->source = $source;
-        $this->target = $target;
+        $this->source = strtolower($source);
+        $this->target = strtolower($target);
         $this->constraint = $constraint;
         $this->description = $description;
     }