diff --git a/src/APIlite.php b/src/APIlite.php index f8f9d40..c316985 100644 --- a/src/APIlite.php +++ b/src/APIlite.php @@ -118,6 +118,7 @@ class APIlite $ref_type = $ref_method->getReturnType(); $method['return'] = $this->reflectionTypeToNames($ref_type, $ref_method->getDeclaringClass()); $method['return_structure'] = $this->reflectionTypeToStructure($ref_type, $ref_method->getDeclaringClass()); + $method['return_doc'] = $this->parseReturnDoc($method['doc']); } $this->methods[] = $method; } @@ -271,6 +272,19 @@ class APIlite return null; } + private function parseReturnDoc(string $doc): string|null + { + $lines = explode("\n", $doc); + foreach ($lines as $line) { + if (strpos($line, '@return') !== false) { + $ret = trim(substr($line, strpos($line, '@return') + strlen('@return'))); + if (strlen($ret) <= 0) return null; + return trim(stristr($ret, ' ')); + } + } + return null; + } + private function response(array $arr): void { ob_clean(); diff --git a/src/help.tpl.php b/src/help.tpl.php index 3f55fe9..5deade4 100644 --- a/src/help.tpl.php +++ b/src/help.tpl.php @@ -827,6 +827,7 @@ $renderParamControl = function (string $methodName, array $param) use ($formatDe

Return:

+