AmfphpDiscoveryService::parseMethodComment PHP Method

parseMethodComment() protected method

- return type If data is missing because comment is incomplete the values are simply not set
protected parseMethodComment ( string $comment ) : array{'returns'
$comment string
return array{'returns'
    protected function parseMethodComment($comment)
    {
        $exploded = explode('@', $comment);
        $ret = array();
        $params = array();
        foreach ($exploded as $tagLine) {
            if (strtolower(substr($tagLine, 0, 5)) == 'param') {
                //type
                $words = explode(' ', $tagLine);
                $type = trim($words[1]);
                $varName = trim(str_replace('$', '', $words[2]));
                $paramMeta = array();
                $paramMeta['type'] = $type;
                //example
                $example = '';
                $examplePos = strpos($tagLine, 'example:');
                if ($examplePos !== false) {
                    $example = substr($tagLine, $examplePos + 8);
                }
                $paramMeta['example'] = $example;
                $params[$varName] = $paramMeta;
            } else {
                if (strtolower(substr($tagLine, 0, 6)) == 'return') {
                    $words = explode(' ', $tagLine);
                    $type = trim($words[1]);
                    $ret['return'] = $type;
                }
            }
        }
        $ret['param'] = $params;
        if (!isset($ret['return'])) {
            $ret['return'] = '';
        }
        return $ret;
    }