+++ /dev/null
-<?php\r
-/**\r
-* Provides functions to access phpdoc xml documents that contain classes.\r
-*\r
-* @author Ulf Wendel <ulf.wendel@phpdoc.de>\r
-* @version 1.0 \r
-* @package PHPDoc\r
-*/\r
-class PhpdocClassAccessor extends PhpdocDocumentAccessor {\r
-\r
- var $xmlkey = "class";\r
- \r
- /**\r
- * Array of inherited elements\r
- * @var array $inherited\r
- */ \r
- var $inherited = array();\r
- \r
- /**\r
- * Returns an array with the data of a class (no functions etc, just the class docs).\r
- * @return array $class\r
- * @access public\r
- */\r
- function getClassdata() {\r
- \r
- $class = $this->xml["class"];\r
-\r
- unset($class["variable"]);\r
- unset($class["function"]);\r
- unset($class["uses"]);\r
- unset($class["constant"]);\r
- unset($class["inherited"]);\r
- unset($class["overriden"]);\r
- unset($class["path"]);\r
- \r
- return $class;\r
- } // end func getClassdata\r
- \r
- /**\r
- * Returns an array of inherited functions.\r
- * @return array \r
- * @access public\r
- * @see getInheritedVariables(), getInheritedUses(), getInheritedConstants()\r
- */\r
- function getInheritedFunctions() {\r
- return $this->inherited["functions"];\r
- } // end func getInheritedFunctions\r
-\r
- /**\r
- * Returns an array of inherited variables.\r
- * @return array\r
- * @access public\r
- * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants()\r
- */ \r
- function getInheritedVariables() {\r
- return $this->inherited["variables"];\r
- } // end func getInheritedVariables\r
- \r
- /**\r
- * Returns an array of inherited included files.\r
- * @return array\r
- * @access public\r
- * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants()\r
- */\r
- function getInheritedUses() {\r
- return $this->inherited["uses"];\r
- } // end func getInheritedUses()\r
- \r
- /**\r
- * Returns an array of inherited constants.\r
- * @return array\r
- * @access public\r
- * @see getInheritedFunctions(), getInheritedVariables(), getInheritedUses()\r
- */\r
- function getInheritedConstants() {\r
- return $this->inherited["constants"];\r
- } // end func getInheritedConstants\r
- \r
- /**\r
- * Returns an array with the "path" of a class.\r
- * @return array $path\r
- * @access public\r
- * @see getSubclasses()\r
- */ \r
- function getClasstree() {\r
- \r
- if (isset($this->xml["class"]["path"]))\r
- return $this->convertPath($this->xml["class"]["path"]);\r
- else \r
- return array();\r
- \r
- } // end func getClasstree\r
- \r
- /**\r
- * Returns an array with all subclasses of a class.\r
- * @return array\r
- * @access public\r
- * @see getClasstree()\r
- */\r
- function getSubclasses() {\r
- return $this->data["subclasses"];\r
- } // end func getSubclasses\r
- \r
-\r
- /**\r
- * Converts a xml path array to a path that can be passed to the user.\r
- * \r
- * The path is an array like path[0..n] = classname where path[0] is the \r
- * directs parent (extends path[0]) and path[n] is the baseclass.\r
- *\r
- * @param array $xmlpath\r
- * @return array $path\r
- */\r
- function convertPath($xmlpath) {\r
-\r
- $path = array();\r
- \r
- if (!isset($xmlpath["parent"][0])) {\r
- \r
- $path[0] = $xmlpath["parent"]["value"]; \r
- \r
- } else {\r
- \r
- reset($xmlpath["parent"]);\r
- while (list($k, $parent)=each($xmlpath["parent"]))\r
- $path[] = $parent["value"];\r
- \r
- }\r
-\r
- return $path;\r
- } // end func convertPath\r
- \r
- /**\r
- * Builds a list of inherited elements.\r
- * @see $inherited\r
- */\r
- function buildInheritedlist() {\r
- \r
- $this->inherited = array(\r
- "functions" => array(),\r
- "variables" => array(),\r
- "constants" => array(),\r
- "uses" => array()\r
- );\r
- \r
- if (isset($this->xml["class"]["inherited"])) {\r
-\r
- if (isset($this->xml["class"]["inherited"][0])) {\r
- \r
- reset($this->xml["class"]["inherited"]);\r
- while (list($k, $inherited)=each($this->xml["class"]["inherited"])) {\r
- \r
- $type = $inherited["type"];\r
- $src = $inherited["src"];\r
- \r
- if (isset($inherited["element"][0])) {\r
- \r
- reset($inherited["element"]);\r
- while (list($k2, $element)=each($inherited["element"])) \r
- $this->inherited[$type][$src][] = $element["value"];\r
- \r
- } else {\r
- \r
- $this->inherited[$type][$src][] = $inherited["element"]["value"];\r
- \r
- }\r
- \r
- }\r
- \r
- } else {\r
- \r
- $inherited = $this->xml["class"]["inherited"];\r
- $type = $inherited["type"];\r
- $src = $inherited["src"];\r
- \r
- if (isset($inherited["element"][0])) {\r
- \r
- reset($inherited["element"]);\r
- while (list($k, $element)=each($inherited["element"])) \r
- $this->inherited[$type][$src][] = $element["value"];\r
- \r
- } else {\r
- \r
- $this->inherited[$type][$src][] = $inherited["element"]["value"];\r
- \r
- }\r
-\r
- }\r
- \r
- unset($this->xml["class"]["inherited"]);\r
- \r
- }\r
- \r
- } // end func buildInheritedlist\r
- \r
- /**\r
- * Builds a list of subclasses\r
- */\r
- function buildSubclasslist() {\r
- \r
- $this->data["subclasses"] = array();\r
- \r
- if (isset($this->xml["class"]["subclasses"])) {\r
- \r
- if (isset($this->xml["class"]["subclasses"]["subclass"][0])) {\r
-\r
- reset($this->xml["class"]["subclasses"]["subclass"]);\r
- while (list($k, $subclass)=each($this->xml["class"]["subclasses"]["subclass"]))\r
- $this->data["subclasses"][] = $subclass["value"];\r
-\r
- } else {\r
-\r
- $this->data["subclasses"][] = $this->xml["class"]["subclasses"]["subclass"]["value"];\r
- \r
- }\r
-\r
- }\r
- \r
- } // end func buildSubclasslist\r
- \r
- function init() {\r
-\r
- #$this->introspection("xml", $this->xml);\r
- \r
- $this->buildInheritedlist();\r
- $this->buildSubclasslist();\r
- \r
- list($this->data["functions"], $this->data["functionsaccess"]) = $this->getElementlist("function"); \r
- list($this->data["variables"], $this->data["variablesaccess"]) = $this->getElementlist("variable");\r
- list($this->data["constants"], $this->data["constantsaccess"]) = $this->getElementlist("constant");\r
- \r
- $this->buildUseslist(); \r
- \r
- #$this->introspection("data", $this->data);\r
-\r
- } // end func Init\r
- \r
-} // end class PhpdocClassAccessor\r
-?>
\ No newline at end of file