Browse Source

Moved method

Rob Bast 10 years ago
parent
commit
bef46a17dc
1 changed files with 21 additions and 16 deletions
  1. 21 16
      src/Composer/Command/InitCommand.php

+ 21 - 16
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<name>[- \.,\p{L}\p{N}\'’]+) <(?P<email>.+?)>$/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 <john@example.com>'
-        );
-    }
 
     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<name>[- \.,\p{L}\p{N}\'’]+) <(?P<email>.+?)>$/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 <john@example.com>'
+        );
+    }
+
     protected function findPackages($name)
     {
         return $this->getRepos()->search($name);