From ee412932f1e46a161d0c48b75eebbe79ea5d8d0d Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Sun, 30 Sep 2012 01:47:50 +0300 Subject: [PATCH] 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; + } +}