From cee63f991de57563d9ae28962544fd961ef7f1ac Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Sun, 18 Nov 2012 17:15:48 +0200 Subject: [PATCH] Revert "Merge pull request #10 from boenrobot/author" This reverts commit 21c36677abb6eaebb1756f70ea8875e6c50a109b, reversing changes made to ffcaa03337247a1713b2f3159b68c26757ee02eb. --- .../Reflection/DocBlock/Tag/AuthorTag.php | 53 ++----- .../Reflection/DocBlock/Tag/AuthorTagTest.php | 138 ------------------ 2 files changed, 11 insertions(+), 180 deletions(-) delete mode 100644 tests/phpDocumentor/Reflection/DocBlock/Tag/AuthorTagTest.php diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php index 65876d1..5819e55 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php @@ -18,7 +18,7 @@ use phpDocumentor\Reflection\DocBlock\Tag; /** * Reflection class for an @author tag in a Docblock. * - * @author Vasil Rangelov + * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -27,11 +27,8 @@ class AuthorTag extends Tag /** @var string The name of the author */ protected $name = ''; - /** @var array Array of URIs belonging to the author, including email */ - protected $uris = array(); - - /** @var string The role of the author */ - protected $role = ''; + /** @var string The email of the author */ + protected $email = ''; /** * Parses a tag and populates the member variables. @@ -44,32 +41,14 @@ class AuthorTag extends Tag { parent::__construct($type, $content, $docblock); if (preg_match( - '/^ - # Name - ([^\<]*) - (?: - # URIs - \<([^>]*)\>\s* - # Role - (?: - \(([^\)]*)\) - )? - # Description - (.*) - )? - $/sux', + '/^([^\<]*)(\<([^\>]*)\>)?$/', $this->description, $matches )) { - $this->name = rtrim($matches[1]); - if (isset($matches[2])) { - $matches[2] = trim($matches[2]); - if ('' !== $matches[2]) { - $this->uris = preg_split('/\s+/u', $matches[2]); - } + $this->name = trim($matches[1]); + if (isset($matches[3])) { + $this->email = trim($matches[3]); } - $this->role = isset($matches[3]) ? trim($matches[3]) : ''; - $this->description = isset($matches[4]) ? trim($matches[4]) : ''; } } @@ -84,22 +63,12 @@ class AuthorTag extends Tag } /** - * Gets the author's URIs. + * Gets the author's email. * - * @return array Array of URIs belonging to the author, including email. + * @return string The author's email. */ - public function getAuthorURIs() + public function getAuthorEmail() { - return $this->uris; - } - - /** - * Gets the author's role. - * - * @return string The role of the author. - */ - public function getAuthorRole() - { - return $this->role; + return $this->email; } } diff --git a/tests/phpDocumentor/Reflection/DocBlock/Tag/AuthorTagTest.php b/tests/phpDocumentor/Reflection/DocBlock/Tag/AuthorTagTest.php deleted file mode 100644 index 46c2f4b..0000000 --- a/tests/phpDocumentor/Reflection/DocBlock/Tag/AuthorTagTest.php +++ /dev/null @@ -1,138 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\DocBlock\Tag; - -/** - * Test class for \phpDocumentor\Reflection\DocBlock\AuthorTag. - * - * @author Vasil Rangelov - * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class AuthorTagTest extends \PHPUnit_Framework_TestCase -{ - /** - * Test that the \phpDocumentor\Reflection\DocBlock\Tag\AuthorTag can - * understand the @author DocBlock. - * - * @param string $type - * @param string $content - * @param string $extractedType - * @param string $extractedVarName - * @param string $extractedDescription - * - * @dataProvider provideDataForConstructor - * - * @return void - */ - public function testConstructorParsesInputsIntoCorrectFields( - $type, - $content, - $extractedName, - $extractedURIs, - $extractedRole, - $extractedDescription - ) { - $tag = new AuthorTag($type, $content); - - $this->assertEquals($extractedName, $tag->getAuthorName()); - $this->assertEquals($extractedURIs, $tag->getAuthorURIs()); - $this->assertEquals($extractedRole, $tag->getAuthorRole()); - $this->assertEquals($extractedDescription, $tag->getDescription()); - } - - /** - * Data provider for testConstructorParsesInputsIntoCorrectFields() - * - * @return array - */ - public function provideDataForConstructor() - { - return array( - array('author', 'Mike van Riel', 'Mike van Riel', array(), '', ''), - array( - 'author', - 'Mike van Riel ', - 'Mike van Riel', - array('mike.vanriel@naenius.com'), - '', - '' - ), - array( - 'author', - 'Mike van Riel ', - 'Mike van Riel', - array('mike.vanriel@naenius.com'), - '', - '' - ), - array( - 'author', - 'Mike van Riel < mike.vanriel@naenius.com>', - 'Mike van Riel', - array('mike.vanriel@naenius.com'), - '', - '' - ), - array( - 'author', - 'Mike van Riel < mike.vanriel@naenius.com >', - 'Mike van Riel', - array('mike.vanriel@naenius.com'), - '', - '' - ), - array( - 'author', - 'Mike van Riel ', - 'Mike van Riel', - array('mike.vanriel@naenius.com', '@mvriel'), - '', - '' - ), - array( - 'author', - 'Mike van Riel (lead)', - 'Mike van Riel', - array('mike.vanriel@naenius.com'), - 'lead', - '' - ), - array( - 'author', - 'Mike van Riel (lead) The one', - 'Mike van Riel', - array('mike.vanriel@naenius.com'), - 'lead', - 'The one' - ), - array( - 'author', - 'Mike van Riel The one', - 'Mike van Riel', - array('mike.vanriel@naenius.com'), - '', - 'The one' - ), - array( - 'author', - 'Mike van Riel <> The one', - 'Mike van Riel', - array(), - '', - 'The one' - ) - ); - } -}