From 50e7366bedf630b93c317abe5c79dcc2a1df57b2 Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Sun, 30 Sep 2012 01:47:50 +0300 Subject: [PATCH 1/2] Added Tag/AuthorTag.php. --- .../Reflection/DocBlock/Tag/AuthorTag.php | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php new file mode 100644 index 0000000..599cd9f --- /dev/null +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php @@ -0,0 +1,58 @@ + + * @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; + +use phpDocumentor\Reflection\DocBlock\Tag; + +/** + * Reflection class for a {@author} tag in a Docblock. + * + * @author Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +class AuthorTag extends Tag +{ + /** @var string The name of the author */ + protected $name = ''; + + /** @var string The email of the author */ + protected $email = ''; + + /** + * Parses a tag and populates the member variables. + * + * @param string $type Name of the tag. + * @param string $content The contents of the given tag. + */ + public function __construct($type, $content) + { + parent::__construct($type, $content); + if (preg_match('/^([^\<]*)(\<([^\>]*)\>)?$/', $content, $matches)) { + $this->name = trim($matches[1]); + if (isset($matches[3])) { + $this->email = trim($matches[3]); + } + } + } + + public function getAuthorName() + { + return $this->name; + } + + public function getAuthorEmail() + { + return $this->email; + } +} From 6ff52dfc59c70e0ccd3d0d80c89b44c92daf8700 Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Mon, 15 Oct 2012 13:17:51 +0300 Subject: [PATCH 2/2] Added doc blocks to the new methods. --- .../Reflection/DocBlock/Tag/AuthorTag.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php index 599cd9f..3eeda2f 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php +++ b/src/phpDocumentor/Reflection/DocBlock/Tag/AuthorTag.php @@ -15,7 +15,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tag; /** - * Reflection class for a {@author} tag in a Docblock. + * Reflection class for an @author tag in a Docblock. * * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT @@ -46,11 +46,21 @@ class AuthorTag extends Tag } } + /** + * Gets the author's name. + * + * @return string The author's name. + */ public function getAuthorName() { return $this->name; } + /** + * Gets the author's email. + * + * @return string The author's email. + */ public function getAuthorEmail() { return $this->email;