3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2002 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Authors: Alan Knowles <alan@akbkhome.com> |
17 // +----------------------------------------------------------------------+
19 require_once 'PHP/CodeDoc/Data.php';
21 * Method and Function Data Container
23 * @package PHP_CodeDoc
25 * @author Alan Knowles <alan@akbkhome.com>
28 class PHP_CodeDoc_Data_Method extends PHP_CodeDoc_Data {
29 var $id; // id in the Classes Operations array (not used yet)
30 var $name; // the name of the method
31 var $type; // Private | Public
32 var $class; // what class it is defined in
33 var $visibility; // Not used (always 1)
34 var $Param; // Array of Methods Parameters.
36 var $description; // phpdoc class
41 function __construct()
43 $this->description = new PHP_CodeDoc_Data_PhpDoc();
46 function mergePhpDoc() {
48 foreach (array_keys($this->Param) as $i) {
49 if (@$this->description->param[$i]) {
50 $this->Param[$i]->type = @$this->description->param[$i]->type;
51 $this->Param[$i]->desc = @$this->description->param[$i]->desc;
53 $this->Param[$i]->shortname = substr($this->Param[$i]->name,1);
55 if (isset($this->Param[$i]->Value)) {
58 if (!isset($this->Param[$i]->Value) && $isOptional) {
59 PHP_CodeDoc_Error::log("Missing optional value in method",$this);
61 $this->Param[$i]->isOptional=$isOptional ;
68 if ($this->type == 'Private') {
74 'is_optional' => false,
82 foreach($this->Param as $i=>$obj) {
83 if (!isset($params[$i])) {
84 $params[$i] = $def_param;
86 $params[$i]['name'] = $obj->name;
88 foreach($this->description->param as $i=>$obj) {
89 if (!isset($params[$i])) {
90 $params[$i] = $def_param;
92 $params[$i]['desc'] = $obj->desc;
93 $params[$i]['type'] = $obj->type;
94 // fixme - is_optional and default values...
101 "name" => $this->name,
111 'name' => $this->name == '__construct' ? ('new ' . $this->class) : $this->name,
112 'purpose' => $this->description->short,
113 'stype' => 'function',
116 'isConstructor' => $this->name == '__construct' ,
119 'name' => $this->name == '__construct' ? ('new ' . $this->class) : $this->name,
120 'is_static' => $this->isStatic ? true:false,
121 'memberof' => $this->class,
122 'returndesc' => $this->name == '_construct' ? '' : $this->description->return->desc,
123 'returntype' => $this->name == '_construct' ? '' : $this->description->return->type,
126 'xtype' => 'Synopsis',
132 'xtype' => 'Section',
135 'html' => $this->description->long,
142 'stype' => 'parameter',
144 'xtype' => 'Section',
149 'xtype' => 'Section',
152 'stype' => 'example',
154 'xtype' => 'Section',