I have written a function which returns the value of a given DocComment tag.
Full example:
<?php
header('Content-Type: text/plain');
class Example
{
public function myMethod()
{
echo 'Hello World!';
}
}
function getDocComment($str, $tag = '')
{
if (empty($tag))
{
return $str;
}
$matches = array();
preg_match("/".$tag.":(.*)(\\r\\n|\\r|\\n)/U", $str, $matches);
if (isset($matches[1]))
{
return trim($matches[1]);
}
return '';
}
$method = new ReflectionMethod('Example', 'myMethod');
echo getDocComment($method->getDocComment(), '@DocTag');
?>
Maybe you can add this functionality to the getDocComment methods of the reflection classes.