public function processDocComment($comment, &$root)
{
if (substr(trim($comment), 0, 3) != '/**') {
return array();
}
// not doc comment, abort
$data = array('docComment' => $comment, 'tags' => array());
$explodedComment = preg_split('/\\n[ \\n\\t\\/]*\\*+[ \\t]*@/', "\n" . $comment);
preg_match_all('/^[ \\t]*[\\/*]*\\**( ?.*)[ \\t\\/*]*$/m', array_shift($explodedComment), $matches);
// changed; we need the leading whitespace to detect multi-line list entries
if (isset($matches[1])) {
$txt = implode("\n", $matches[1]);
$data['tags']['@text'] = $this->createTag('@text', trim($txt, " \n\t\v*/"), $data, $root);
}
foreach ($explodedComment as $tag) {
// process tags
// strip whitespace, newlines and asterisks
$tag = preg_replace('/(^[\\s\\n\\*]+|[\\s\\*]*\\*\\/$)/m', ' ', $tag);
// fixed: empty comment lines at end of docblock
$tag = preg_replace('/\\n+/', '', $tag);
$tag = trim($tag);
$parts = preg_split('/\\s+/', $tag);
$name = isset($parts[0]) ? array_shift($parts) : $tag;
$text = join(' ', $parts);
if ($name) {
switch ($name) {
case 'package':
// place current element in package
// place current element in package
case 'namespace':
if (!$this->_ignorePackageTags) {
// unless we're ignoring package tags
$data['package'] = $text;
}
break;
case 'var':
// set variable type
$data['type'] = $text;
break;
case 'access':
// set access permission
$data['access'] = $text;
break;
case 'final':
// element is final
$data['final'] = TRUE;
break;
case 'abstract':
// element is abstract
$data['abstract'] = TRUE;
break;
case 'static':
// element is static
$data['static'] = TRUE;
break;
default:
//create tag
$name = '@' . $name;
if (isset($data['tags'][$name])) {
if (is_array($data['tags'][$name])) {
$data['tags'][$name][] = $this->createTag($name, $text, $data, $root);
} else {
$data['tags'][$name] = array($data['tags'][$name], $this->createTag($name, $text, $data, $root));
}
} else {
$data['tags'][$name] =& $this->createTag($name, $text, $data, $root);
}
}
}
}
return $data;
}