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

main
Igor Wiedler 13 years ago
parent 900bed1c32
commit 9e8fc71870

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

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

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

Loading…
Cancel
Save