From eba0b4f7f3b00657c45878755d26e198b3029ac9 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 14 Oct 2016 10:34:04 +0800 Subject: [PATCH] CodeDoc/Data/Class.php --- CodeDoc/Data/Class.php | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 CodeDoc/Data/Class.php diff --git a/CodeDoc/Data/Class.php b/CodeDoc/Data/Class.php new file mode 100644 index 0000000..8c9a9af --- /dev/null +++ b/CodeDoc/Data/Class.php @@ -0,0 +1,85 @@ + | +// +----------------------------------------------------------------------+ +// +require_once 'PHP/CodeDoc/Data.php'; +/** +* Class Data Container +* +* @package PHP_CodeDoc +* @access public +* @author Alan Knowles +* +*/ +class PHP_CodeDoc_Data_Class { + var $id; // id in the big classes array. + var $name; // the name of the class + var $filename; // original filename + var $rfilename; // relative filename in relation to root directory. + var $rdir; // relative directory + var $Parent; // Parent Class (maybe an array in PHP5?) + var $Operations =array(); // Array of Method Classes + var $Attributes =array(); // Array of Var Classes + var $iOperations =array(); // Array of inherited Method Classes + var $iAttributes =array(); // Array of inherited Var Classes + + var $package=""; // package name if any + var $copyright; // copyright + var $extends = array(); // Array of Parents (names) + + var $description; // phpdoc class + + + function output_extends() { // cheesy tree?? = better ideas; + $indent=0; + $t = count($this->extends) -1; + for ($i=0;$i<$t+1;$i++) { + echo "\n"; + if ($i) + echo str_repeat(' ',$i) . "|\n". str_repeat(' --',$i); + + //if ($i != $t) { // last one = no link + echo ''.$this->extends[$i].''; + //} else { + //echo $this->extends[$i]; + //} + } + } +// move later to inherited + function toJS() + { + $ret = array(); + $cats = array(); + foreach($this->Operations as $op) { + + if (!isset($cats[$op->description->category])) { + echo "missing Category for {$this->name}::{$op->name}\n"; + } else { + $cats[$op->description->category] = isset($cats[$op->description->category]) ? $cats[$op->description->category] : array(); + $cats[$op->description->category][] = strtolower($this->name)). '/'.$op->name; + } + $ret[str_replace('_','-',strtolower($this->name)). '/'.$op->name] = $op->toJS(); + } + foreach($this->Attributes as $op) { + // $ret[$this->name . '.'.$op->name] = $op->toJS(); + } + return $ret; + } + + +} +?> \ No newline at end of file -- 2.39.2