Skip to content

Commit ee41293

Browse files
committed
Added Tag/AuthorTag.php.
1 parent 4235bee commit ee41293

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* phpDocumentor
4+
*
5+
* PHP Version 5
6+
*
7+
* @author Mike van Riel <[email protected]>
8+
* @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com)
9+
* @license http://www.opensource.org/licenses/mit-license.php MIT
10+
* @link http://phpdoc.org
11+
*/
12+
13+
namespace phpDocumentor\Reflection\DocBlock\Tag;
14+
15+
use phpDocumentor\Reflection\DocBlock\Tag;
16+
17+
/**
18+
* Reflection class for a {@author} tag in a Docblock.
19+
*
20+
* @author Mike van Riel <[email protected]>
21+
* @license http://www.opensource.org/licenses/mit-license.php MIT
22+
* @link http://phpdoc.org
23+
*/
24+
class AuthorTag extends Tag
25+
{
26+
/** @var string The name of the author */
27+
protected $name = '';
28+
29+
/** @var string The email of the author */
30+
protected $email = '';
31+
32+
/**
33+
* Parses a tag and populates the member variables.
34+
*
35+
* @param string $type Name of the tag.
36+
* @param string $content The contents of the given tag.
37+
*/
38+
public function __construct($type, $content)
39+
{
40+
parent::__construct($type, $content);
41+
if (preg_match('/^([^\<]*)(\<([^\>]*)\>)?$/', $content, $matches)) {
42+
$this->name = trim($matches[1]);
43+
if (isset($matches[3])) {
44+
$this->email = trim($matches[3]);
45+
}
46+
}
47+
}
48+
49+
public function getAuthorName()
50+
{
51+
return $this->name;
52+
}
53+
54+
public function getAuthorEmail()
55+
{
56+
return $this->email;
57+
}
58+
}

0 commit comments

Comments
 (0)