diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index ae3fc8330..47fa20c28 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -38,22 +38,6 @@ class InitCommand extends Command private $gitConfig; private $pool; - public function parseAuthorString($author) - { - if (preg_match('/^(?P[- \.,\p{L}\p{N}\'’]+) <(?P.+?)>$/u', $author, $match)) { - if ($this->isValidEmail($match['email'])) { - return array( - 'name' => trim($match['name']), - 'email' => $match['email'] - ); - } - } - - throw new \InvalidArgumentException( - 'Invalid author string. Must be in the format: '. - 'John Smith ' - ); - } protected function configure() { @@ -293,6 +277,27 @@ EOT $input->setOption('require-dev', $devRequirements); } + /** + * @param string $author + * @return array + */ + public function parseAuthorString($author) + { + if (preg_match('/^(?P[- \.,\p{L}\p{N}\'’]+) <(?P.+?)>$/u', $author, $match)) { + if ($this->isValidEmail($match['email'])) { + return array( + 'name' => trim($match['name']), + 'email' => $match['email'] + ); + } + } + + throw new \InvalidArgumentException( + 'Invalid author string. Must be in the format: '. + 'John Smith ' + ); + } + protected function findPackages($name) { return $this->getRepos()->search($name);