From 11d55123685d4ede626194beb427baf030f662cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IT=E5=B0=8F=E5=BC=BAxqitw=2Ecn?= <360237521@qq.com> Date: Wed, 6 Jun 2018 09:41:51 +0800 Subject: [PATCH] =?UTF-8?q?ApiDoc=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ApiDoc.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ApiDoc.php b/src/ApiDoc.php index a6bf1a4..f2df20b 100644 --- a/src/ApiDoc.php +++ b/src/ApiDoc.php @@ -64,10 +64,11 @@ class ApiDoc */ public function getApiDoc($type = \ReflectionMethod::IS_PUBLIC) { foreach ($this->class as $classItem) { - $this->ApiTree[$classItem] = [ - 'class' => $this->_getClassComment($classItem), - 'action' => $this->_getActionComment($classItem, $type) - ]; + $actionInfo = $this->_getActionComment($classItem, $type); + if (count($actionInfo) >= 1) { + $this->ApiTree[$classItem] = $this->_getClassComment($classItem); + $this->ApiTree[$classItem]['action'] = $actionInfo; + } } return $this->ApiTree; } @@ -112,7 +113,10 @@ class ApiDoc $parse = new ParseComment(); foreach ($method as $action) { 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) { continue; }