views:

39

answers:

2

I want to fetch a method's comments,take below method for example:

/**
* Returns the regex to extract all inputs from a file.
* @param string The class name to search for.
* @return string The regex.
*/
public function method($param)
{
  //...
}

the result should be

Returns the regex to extract all inputs from a file.
@param string The class name to search for.
@return string The regex.

the way I find is use a function like file_get_content to get file content -> filter the method I want -> fetch the comment use regexp

it seems a bit complicated , is there any convenient way to archive this?

+1  A: 

PHP Doc. Like Java Doc.

VDVLeon
+3  A: 

If you want to use the comment in PHP for something check out getDocComment in php's reflection api

rojoca
thanks , exactly what I want :)
lzyy
after a deep look , it isn't what I need . getDocComment just fetch class's comment , not method's. so I write a small script to do this http://gist.github.com/329113
lzyy