From fa5f40d0c575950aaa7dfac220ac5601707c55ef Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 25 Oct 2016 15:04:07 +0800 Subject: [PATCH] CodeDoc/Data/Param.php --- CodeDoc/Data/Param.php | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 CodeDoc/Data/Param.php diff --git a/CodeDoc/Data/Param.php b/CodeDoc/Data/Param.php new file mode 100644 index 0000000..a2df732 --- /dev/null +++ b/CodeDoc/Data/Param.php @@ -0,0 +1,83 @@ + | +// +----------------------------------------------------------------------+ +// + +/** +* Method and Class parameter data container +* +* @package PHP_CodeDoc +* @access public +* @author Alan Knowles +* +*/ +class PHP_CodeDoc_Data_Param { + var $name =''; // name of parameter + var $Value = ''; // default value + var $desc = ''; + var $type = ''; + + + function descToHTML() + { + + $lines = explode("\n", $this->desc); + if (count($lines) < 2) { + return $this->desc; + } + if (preg_match('/array/i', $this->type) && preg_match('/\+\s+[a-z0-9_-]+:/', $this->desc)) { + // dl list... + + $ret = array_shift($lines) . "
"; + $cur = false; + $sets = array(); + foreach($lines as $l) { + $m = array(); + if (preg_match('/^\s+\+\s+([a-z0-9_-]+):\s+(.*)$/i', $l, $m)) { + if ($cur) { + $sets[] = $cur; + } + $cur = array('key'=>$m[1], 'val' => $m[2] ); + continue; + } + if ($cur) { + $cur['val'] .= "\n" . $l; + } + + } + if ($cur) { + $sets[] = $cur; + } + + foreach($sets as $kv) { + $ret.="
" . $kv['key'] . '
' . str_replace('\n', '
', htmlspecialchars($kv['val'])) . '
'; + } + return $ret; + } + + + return implode('
', $lines); + + + + + + + } + +} + \ No newline at end of file -- 2.39.2