ApiDoc生成

This commit is contained in:
IT小强xqitw.cn 2018-06-06 09:41:51 +08:00
parent e08d453689
commit 11d5512368

View File

@ -64,10 +64,11 @@ class ApiDoc
*/ */
public function getApiDoc($type = \ReflectionMethod::IS_PUBLIC) { public function getApiDoc($type = \ReflectionMethod::IS_PUBLIC) {
foreach ($this->class as $classItem) { foreach ($this->class as $classItem) {
$this->ApiTree[$classItem] = [ $actionInfo = $this->_getActionComment($classItem, $type);
'class' => $this->_getClassComment($classItem), if (count($actionInfo) >= 1) {
'action' => $this->_getActionComment($classItem, $type) $this->ApiTree[$classItem] = $this->_getClassComment($classItem);
]; $this->ApiTree[$classItem]['action'] = $actionInfo;
}
} }
return $this->ApiTree; return $this->ApiTree;
} }
@ -112,7 +113,10 @@ class ApiDoc
$parse = new ParseComment(); $parse = new ParseComment();
foreach ($method as $action) { foreach ($method as $action) {
try { try {
$comments[] = $parse->parseCommentToArray($action->getDocComment()); $actionComments = $parse->parseCommentToArray($action->getDocComment());
if (count($actionComments) >= 1 && !in_array($action->name, $this->filterMethod)) {
$comments[$action->name] = $actionComments;
}
} catch (\Exception $exception) { } catch (\Exception $exception) {
continue; continue;
} }