+++ /dev/null
-<?php\r
-/**\r
-* Exports the data of a class as an xml file.\r
-*\r
-* @version $Id: PhpdocXMLClassExporter.php,v 1.2 2000/12/03 22:37:38 uw Exp $\r
-*/\r
-class PhpdocXMLClassExporter extends PhpdocXMLDocumentExporter {\r
-\r
- /**\r
- * Variable container attributes.\r
- * @var array $variableAttributes\r
- */ \r
- var $variableAttributes = array(\r
- "name" => "CDATA",\r
- "access" => "CDATA",\r
- "type" => "CDATA",\r
- "abstract" => "Boolean",\r
- "static" => "Boolean",\r
- "final" => "Boolean"\r
- ); \r
- /**\r
- * Class container attributes.\r
- * @var array $classAttributes\r
- */\r
- var $classAttributes = array( \r
- "name" => "CDATA",\r
- "extends" => "CDATA",\r
- "undoc" => "Boolean",\r
- "access" => "CDATA",\r
- "abstract" => "Boolean",\r
- "static" => "Boolean",\r
- "final" => "Boolean",\r
- "package" => "CDATA"\r
- );\r
-\r
- var $fileprefix = "class_";\r
- \r
- function PhpdocXMLClassExporter() {\r
- $this->PHPDocXMLExporter();\r
- } // end constructor\r
- \r
- function create() {\r
- \r
- $attribs = $this->getAttributes($this->result, $this->classAttributes); \r
- $this->xmlwriter->startElement("class", "", $attribs, false);\r
- \r
- $this->filenameXML($this->result["filename"]);\r
- \r
- $this->docXML($this->result); \r
- \r
- if (isset($this->result["functions"]))\r
- $this->functionsXML($this->result["functions"]);\r
- \r
- if (isset($this->result["variables"]))\r
- $this->variablesXML($this->result["variables"]);\r
- \r
- if (isset($this->result["uses"]))\r
- $this->usesXML($this->result["uses"]);\r
- \r
- if (isset($this->result["consts"]))\r
- $this->constsXML($this->result["consts"]);\r
- \r
- if (isset($this->result["inherited"]))\r
- $this->inheritedOverridenXML($this->result["inherited"], "inherited");\r
- \r
- if (isset($this->result["overriden"]))\r
- $this->inheritedOverridenXML($this->result["overriden"], "overriden");\r
- \r
- if (isset($this->result["path"]))\r
- $this->pathXML($this->result["path"]);\r
- \r
- if (isset($this->result["baseclass"]))\r
- $this->baseclassXML($this->result["baseclass"]);\r
- \r
- if (isset($this->result["subclasses"]))\r
- $this->subclassesXML($this->result["subclasses"]);\r
- \r
- $this->xmlwriter->endElement("class", true);\r
- \r
- } // end func create\r
- \r
- /**\r
- * Handles inherited and overriden elements.\r
- * \r
- * @param array Array of inherited or overriden elements\r
- * @param string Container used when saving the elements\r
- */\r
- function inheritedOverridenXML($data, $tag) {\r
- \r
- reset($data);\r
- while (list($type, $elements) = each($data)) {\r
- \r
- reset($elements);\r
- while (list($from, $data2) = each($elements)) {\r
-\r
- $attribs = $this->getAttributes( array ("type" => $type, "src" => $from), $this->inheritedOverridenAttributes); \r
- $this->xmlwriter->startElement($tag, "", $attribs, false);\r
- \r
- reset($data2);\r
- while (list($name, $v) = each($data2))\r
- $this->xmlwriter->addElement("element", $name);\r
- \r
- $this->xmlwriter->endElement($tag, true);\r
- \r
- }\r
- \r
- }\r
- \r
- } // end func inheritedOverridenXML\r
-\r
- /**\r
- * Writes the "path" (inheritance chain) of an element.\r
- *\r
- * @param array\r
- */ \r
- function pathXML($path) {\r
- if (0 == count($path))\r
- return;\r
- \r
- $this->xmlwriter->startElement("path", "", "", false); \r
- \r
- reset($path);\r
- while (list($k, $parent) = each($path)) \r
- $this->xmlwriter->addElement("parent", $parent);\r
- \r
- $this->xmlwriter->endElement("path", true);\r
- \r
- } // end func pathXML\r
- \r
- /**\r
- * Adds a baseclass container to the generated xml.\r
- *\r
- * @param string Name of the baseclass\r
- */\r
- function baseclassXML($base) {\r
- \r
- if ("" != $base)\r
- $this->xmlwriter->addElement("baseclass", $base);\r
- \r
- } // end func baseclassXML\r
- \r
- /**\r
- * Adds a list of subclasses to the generated xml.\r
- *\r
- * @param array \r
- */\r
- function subclassesXML($subclasses) {\r
- if (0 == count($subclasses))\r
- return;\r
- \r
- $this->xmlwriter->startElement("subclasses", "", "", false, true); \r
- \r
- reset($subclasses);\r
- while(list($subclass, $v) = each($subclasses)) \r
- $this->xmlwriter->addElement("subclass", $subclass);\r
- \r
- $this->xmlwriter->endElement("subclasses", true);\r
- \r
- } // end func subclassesXML\r
- \r
- /**\r
- * Adds class variables to the XMl document.\r
- *\r
- * @param array\r
- */\r
- function variablesXML($variables) {\r
- \r
- reset($variables);\r
- while (list($variable, $data) = each($variables)) {\r
- \r
- $attribs = $this->getAttributes($data, $this->variableAttributes);\r
- $this->xmlwriter->startElement("variable", $data["value"], $attribs, false);\r
- $this->docXML($data);\r
- $this->xmlwriter->endElement("variable", true);\r
- \r
- }\r
- \r
- } // end func variablesXML\r
- \r
-} // end class PhpdocXMLClassExporter\r
-?>
\ No newline at end of file