1
0
Fork 0

Make sure suggested value conforms to allowed values

Regex for replacement from https://github.com/composer/packagist/blob/master/src/Packagist/WebBundle/Entity/Package.php#L191
pull/1349/head
Colin Frei 2012-11-20 20:53:19 +01:00
parent 6c4bdd14cd
commit b4cf3d06fd
1 changed files with 2 additions and 0 deletions

View File

@ -159,6 +159,8 @@ EOT
if (!$name = $input->getOption('name')) { if (!$name = $input->getOption('name')) {
$name = basename($cwd); $name = basename($cwd);
$name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
$name = strtolower($name);
if (isset($git['github.user'])) { if (isset($git['github.user'])) {
$name = $git['github.user'] . '/' . $name; $name = $git['github.user'] . '/' . $name;
} elseif (!empty($_SERVER['USERNAME'])) { } elseif (!empty($_SERVER['USERNAME'])) {