1
0
Fork 0

Merge pull request #13 from igorw/case-insensitive-package

Make package names and downloader/installer/repository types case insensitive
pull/16/head
Nils Adermann 2011-09-14 07:06:57 -07:00
commit b6ec172997
3 changed files with 7 additions and 3 deletions

View File

@ -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);
}

View File

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

View File

@ -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;
}