src/Leevel/Kernel/Utils/Doc.php
protected function parseMethodBody(array $lines, ReflectionMethod $method, bool $isDoc = false): string
    {
        $startLine = $method->getStartLine() - 1;
        $endLine = $method->getEndLine();
        $offsetLength = 4;
        $findEot = false;
        $result = [];

        // 文档类删除周围的函数定制
        // 并且删除掉注释 `/**/` 标记
        if ($isDoc) {
            $startLine += 3;
            $endLine -= 2;
            $offsetLength = 8;
        }

        foreach ($lines as $k => $v) {
            if ($k < $startLine || $k >= $endLine) {
                continue;
            }

            if (false !== strpos($v, 'eot')) {
                $findEot = true;

                break;
            }
        }

        foreach ($lines as $k => $v) {
            if ($k < $startLine || $k >= $endLine) {
                continue;
            }

            // 占位符行
            if ('#_' === trim($v)) {
                continue;
            }

            if (true === $findEot) {
                // eot 需要特别处理
                if ($k === $startLine ||
                    $k === $startLine + 1 ||
                    $k === $endLine - 1 ||
                    (strlen($v) - strlen(ltrim($v)) >= $offsetLength + 4)) {
                    $result[] = substr($v, $offsetLength);
                } else {
                    $result[] = $v;
                }
            } else {
                $result[] = substr($v, $offsetLength);
            }
        }

        return implode(PHP_EOL, $result);
    }
protected function parseMethodBody(array $lines, ReflectionMethod $method, bool $isDoc = false): string
    {
        $startLine = $method->getStartLine() - 1;
        $endLine = $method->getEndLine();
        $offsetLength = 4;
        $findEot = false;
        $result = [];

        // 文档类删除周围的函数定制
        // 并且删除掉注释 `/**/` 标记
        if ($isDoc) {
            $startLine += 3;
            $endLine -= 2;
            $offsetLength = 8;
        }

        foreach ($lines as $k => $v) {
            if ($k < $startLine || $k >= $endLine) {
                continue;
            }

            if (false !== strpos($v, 'eot')) {
                $findEot = true;

                break;
            }
        }

        foreach ($lines as $k => $v) {
            if ($k < $startLine || $k >= $endLine) {
                continue;
            }

            // 占位符行
            if ('#_' === trim($v)) {
                continue;
            }

            if (true === $findEot) {
                // eot 需要特别处理
                if ($k === $startLine ||
                    $k === $startLine + 1 ||
                    $k === $endLine - 1 ||
                    (strlen($v) - strlen(ltrim($v)) >= $offsetLength + 4)) {
                    $result[] = substr($v, $offsetLength);
                } else {
                    $result[] = $v;
                }
            } else {
                $result[] = substr($v, $offsetLength);
            }
        }

        return implode(PHP_EOL, $result);
    }
解析方法内容.

@param array             $lines
@param \ReflectionMethod $method
@param bool              $isDoc

@return string