CHAPTER 7 ■ REFLECTION API^95Listing 7-19. Creating the DocumentingReflectionClass (DocumentingReflection.php)class DocumentingReflectionClass extends ReflectionClass {protected $_comments, $_tags, $_tokens;public function __construct($class) {parent::__construct($class);$docComment = $this->getDocComment();
$parsedComment = DocumentingReflection::ParseDocComment($docComment);$this->_comments = $parsedComment['comments'];
$this->_tags = $parsedComment['tags'];
$this->_tokens = $parsedComment['tokens'];}public function getMethods() {
$methods = array();foreach(parent::getMethods() as $method) {
$methods[] = new DocumentingReflectionMethod(
$this->getName(), $method->getName()
);
}return $methods;
}public function printDocTokens() {
foreach($this->_tokens as $token) {
echo $token[0]. '=';
echo docblock_token_name($token[0]). '=';
print_r($token[1]);
echo "\n";
}
}public function getParsedTags() {
return $this->_tags;
}public function getParsedComments() {
return $this->_comments;
}}McArthur_819-9C07.fm Page 95 Friday, February 22, 2008 8:59 AM