Skip to content

Commit 5941846

Browse files
committed
Merge pull request #7 from boenrobot/patch-3
Reflection for the author tag.
2 parents aa61de9 + 95ad95d commit 5941846

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 an @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+
/**
50+
* Gets the author's name.
51+
*
52+
* @return string The author's name.
53+
*/
54+
public function getAuthorName()
55+
{
56+
return $this->name;
57+
}
58+
59+
/**
60+
* Gets the author's email.
61+
*
62+
* @return string The author's email.
63+
*/
64+
public function getAuthorEmail()
65+
{
66+
return $this->email;
67+
}
68+
}

0 commit comments

Comments
 (0)