| // +----------------------------------------------------------------------+ // require_once 'PHP/CodeDoc/Data.php'; /** * Method and Function Data Container * * @package PHP_CodeDoc * @access public * @author Alan Knowles * */ class PHP_CodeDoc_Data_Method extends PHP_CodeDoc_Data { var $id; // id in the Classes Operations array (not used yet) var $name; // the name of the method var $type; // Private | Public var $class; // what class it is defined in var $visibility; // Not used (always 1) var $Param; // Array of Methods Parameters. var $description; // phpdoc class var $isPublic = 1; var $isStatic = 0; var $isFinal = 0; function __construct() { $this->description = new PHP_CodeDoc_Data_PhpDoc(); } function mergePhpDoc() { $isOptional = FALSE; foreach (array_keys($this->Param) as $i) { if (@$this->description->param[$i]) { $this->Param[$i]->type = @$this->description->param[$i]->type; $this->Param[$i]->desc = @$this->description->param[$i]->desc; } $this->Param[$i]->shortname = substr($this->Param[$i]->name,1); if (isset($this->Param[$i]->Value)) { $isOptional =TRUE; } if (!isset($this->Param[$i]->Value) && $isOptional) { PHP_CodeDoc_Error::log("Missing optional value in method",$this); } $this->Param[$i]->isOptional=$isOptional ; } } function toJs() { if ($this->type == 'Private') { return false; } $def_param = array( 'desc' => '', 'is_optional' => false, 'name' => '', 'type' => '', '|xns' => 'Roo.doc', 'xtype' => 'Param', ); $params = array(); foreach($this->Param as $i=>$obj) { if (!isset($params[$i])) { $params[$i] = $def_param; } $params[$i]['name'] = $obj->name; } foreach($this->description->param as $i=>$obj) { if (!isset($params[$i])) { $params[$i] = $def_param; } $params[$i]['desc'] = $obj->desc; $params[$i]['type'] = $obj->type; // fixme - is_optional and default values... } return array( "name" => $this->name == '__construct' ? ('new ' . $this->class) : $this->name, "parent" => "", "title" => "", "permname" => "", "modOrder" => "001", "items" => array( array( 'name' => $this->name, 'purpose' => $this->description->short, 'stype' => 'function', '|xns' => 'Roo.doc', 'xtype' => 'Entry', 'items' => array( array( 'name' => $this->name == '__construct' ? ('new ' . $this->class) : $this->name, 'is_static' => $this->isStatic ? true:false, 'memberof' => $this->class, 'returndesc' => $this->name == '_construct' ? '' : $this->description->return->desc, 'returntype' => $this->name == '_construct' ? '' : $this->description->return->type, '|xns' => 'Roo.doc', 'xtype' => 'Synopsis', 'items' => $params ), array( 'stype' => 'desc', '|xns' => 'Roo.doc', 'xtype' => 'Section', 'items' => array( array( 'html' => $this->description->long, '|xns' => 'Roo.doc', 'xtype' => 'Para', ) ) ), array( 'stype' => 'parameter', '|xns' => 'Roo.doc', 'xtype' => 'Section', ), array( 'stype' => 'return', '|xns' => 'Roo.doc', 'xtype' => 'Section', ), array( 'stype' => 'example', '|xns' => 'Roo.doc', 'xtype' => 'Section', ) ) ) ) ); } }