5 * Parses for an API function documentation block.
11 * @author Paul M. Jones <pmjones@php.net>
15 * @version $Id: Function.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
21 * Parses for an API function documentation block.
27 * @author Paul M. Jones <pmjones@php.net>
31 class Text_Wiki_Parse_Function
extends Text_Wiki_Parse
{
33 var $regex = '/^(\<function\>)\n(.+)\n(\<\/function\>)(\s|$)/Umsi';
35 function process(&$matches)
46 // split apart the markup lines and loop through them
47 $lines = explode("\n", $matches[2]);
48 foreach ($lines as $line) {
51 if (trim($line) == '') {
55 // find the first ':' on the line; the left part is the
56 // type, the right part is the value. skip lines without
58 $pos = strpos($line, ':');
63 // $type is the line type: name, access, return, param, throws
66 $type = trim(substr($line, 0, $pos));
67 $val = trim(substr($line, $pos+
1));
73 $opts['access'] = $val;
83 $tmp = explode(',', $val);
86 $opts['params'][] = array(
92 $opts['params'][] = array(
98 $opts['params'][] = array(
109 $opts['return'] = $val;
114 $tmp = explode(',', $val);
117 $opts['throws'][] = array(
122 $opts['throws'][] = array(
136 // add the token back in place
137 return $this->wiki
->addToken($this->rule
, $opts) . $matches[4];