uw Sun Feb 18 07:03:06 2001 EDT Modified files: /php4/pear/PHPDoc/accessor PhpdocAccessor.php PhpdocClassAccessor.php PhpdocDocumentAccessor.php PhpdocIndexAccessor.php PhpdocModuleAccessor.php PhpdocWarningAccessor.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces.
Index: php4/pear/PHPDoc/accessor/PhpdocAccessor.php diff -u php4/pear/PHPDoc/accessor/PhpdocAccessor.php:1.1 php4/pear/PHPDoc/accessor/PhpdocAccessor.php:1.2 --- php4/pear/PHPDoc/accessor/PhpdocAccessor.php:1.1 Sun Oct 8 03:03:18 2000 +++ php4/pear/PHPDoc/accessor/PhpdocAccessor.php Sun Feb 18 07:03:05 2001 @@ -4,74 +4,76 @@ * * It's up to you eigther to use this class to access * the phpdoc xml files or to write your own parser. +* +* @version $Id: PhpdocAccessor.php,v 1.2 2001/02/18 15:03:05 uw Exp $ */ class PhpdocAccessor extends PhpdocObject { - /** - * Instance of PhpdocXMLReader - * @var object PhpdocXMLReader $xmlreader - */ - var $xmlreader; - - /** - * Result of the PhpdocXMLReader - * @var array $xml - */ - var $xml = array(); - - /** - * Free xml resources on calling a getXY() function? - * - * One of the design goals was to minimize the memory consumption of PHPdoc. - * So PHPdoc tries to save data as soon as possible to the disk, reuse objects - * and free resources of an object when they are no longer needed. The default - * value of true will cause the object to free the memory used by the - * xml data as soon as possible. - * - * @var boolean - */ - var $freeOnGet = true; + /** + * Instance of PhpdocXMLReader + * @var object PhpdocXMLReader $xmlreader + */ + var $xmlreader; + + /** + * Result of the PhpdocXMLReader + * @var array $xml + */ + var $xml = array(); + + /** + * Free xml resources on calling a getXY() function? + * + * One of the design goals was to minimize the memory consumption of PHPdoc. + * So PHPdoc tries to save data as soon as possible to the disk, reuse objects + * and free resources of an object when they are no longer needed. The default + * value of true will cause the object to free the memory used by the + * xml data as soon as possible. + * + * @var boolean + */ + var $freeOnGet = true; - /** - * Reformatted PhpdocXMLReader result array - * @var array - */ - var $data = array(); - - /** - * Loads the specified xml file. - * - * @param string Name of the xml file - * @return boolean False if the given xml file was not - * found or is empty otherwise true. - * @access public - * @see init() - */ - function loadXMLFile($filename) { - - $this->xmlreader = new PhpdocXMLReader; - - $this->xml = $this->xmlreader->parse($filename); - $this->xml = $this->xml["phpdoc"]; - $ok = (!is_array($this->xml) || 0==count($this->xml)) ? false : true; - - $this->init(); - - return $ok; - } // end func loadXMLFile - - /** - * Reformats the xml result array from the PhpdocXMLReader. - * - * Every derived class must override this function to call the functions - * it needs to reorganize the data from the PhpdocXMLReader in a - * way that it needs. - * - * @abstract - * @see $xml, $data - */ - function init() { - } // end func init + /** + * Reformatted PhpdocXMLReader result array + * @var array + */ + var $data = array(); + + /** + * Loads the specified xml file. + * + * @param string Name of the xml file + * @return boolean False if the given xml file was not + * found or is empty otherwise true. + * @access public + * @see init() + */ + function loadXMLFile($filename) { + + $this->xmlreader = new PhpdocXMLReader; + + $this->xml = $this->xmlreader->parse($filename); + $this->xml = $this->xml["phpdoc"]; + $ok = (!is_array($this->xml) || 0 == count($this->xml)) ? false : true; + + $this->init(); + + return $ok; + } // end func loadXMLFile + + /** + * Reformats the xml result array from the PhpdocXMLReader. + * + * Every derived class must override this function to call the functions + * it needs to reorganize the data from the PhpdocXMLReader in a + * way that it needs. + * + * @abstract + * @see $xml, $data + */ + function init() { + } // end func init } // end class PhpdocAccessor ?> Index: php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php diff -u php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php:1.1 php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php:1.2 --- php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php:1.1 Sun Oct 8 03:03:18 2000 +++ php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php Sun Feb 18 07:03:05 2001 @@ -2,238 +2,245 @@ /** * Provides functions to access phpdoc xml documents that contain classes. * -* @author Ulf Wendel <[EMAIL PROTECTED]> -* @version 1.0 -* @package PHPDoc +* @author Ulf Wendel <[EMAIL PROTECTED]> +* @version $Id: PhpdocClassAccessor.php,v 1.2 2001/02/18 15:03:05 uw Exp $ */ class PhpdocClassAccessor extends PhpdocDocumentAccessor { - var $xmlkey = "class"; - - /** - * Array of inherited elements - * @var array $inherited - */ - var $inherited = array(); - - /** - * Returns an array with the data of a class (no functions etc, just the class docs). - * @return array $class - * @access public - */ - function getClassdata() { - - $class = $this->xml["class"]; - - unset($class["variable"]); - unset($class["function"]); - unset($class["uses"]); - unset($class["constant"]); - unset($class["inherited"]); - unset($class["overriden"]); - unset($class["path"]); - - return $class; - } // end func getClassdata - - /** - * Returns an array of inherited functions. - * @return array - * @access public - * @see getInheritedVariables(), getInheritedUses(), getInheritedConstants() - */ - function getInheritedFunctions() { - return $this->inherited["functions"]; - } // end func getInheritedFunctions - - /** - * Returns an array of inherited variables. - * @return array - * @access public - * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants() - */ - function getInheritedVariables() { - return $this->inherited["variables"]; - } // end func getInheritedVariables - - /** - * Returns an array of inherited included files. - * @return array - * @access public - * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants() - */ - function getInheritedUses() { - return $this->inherited["uses"]; - } // end func getInheritedUses() - - /** - * Returns an array of inherited constants. - * @return array - * @access public - * @see getInheritedFunctions(), getInheritedVariables(), getInheritedUses() - */ - function getInheritedConstants() { - return $this->inherited["constants"]; - } // end func getInheritedConstants - - /** - * Returns an array with the "path" of a class. - * @return array $path - * @access public - * @see getSubclasses() - */ - function getClasstree() { - - if (isset($this->xml["class"]["path"])) - return $this->convertPath($this->xml["class"]["path"]); - else - return array(); - - } // end func getClasstree - - /** - * Returns an array with all subclasses of a class. - * @return array - * @access public - * @see getClasstree() - */ - function getSubclasses() { - return $this->data["subclasses"]; - } // end func getSubclasses - - - /** - * Converts a xml path array to a path that can be passed to the user. - * - * The path is an array like path[0..n] = classname where path[0] is the - * directs parent (extends path[0]) and path[n] is the baseclass. - * - * @param array $xmlpath - * @return array $path - */ - function convertPath($xmlpath) { - - $path = array(); - - if (!isset($xmlpath["parent"][0])) { - - $path[0] = $xmlpath["parent"]["value"]; - - } else { - - reset($xmlpath["parent"]); - while (list($k, $parent)=each($xmlpath["parent"])) - $path[] = $parent["value"]; - - } - - return $path; - } // end func convertPath - - /** - * Builds a list of inherited elements. - * @see $inherited - */ - function buildInheritedlist() { - - $this->inherited = array( - "functions" => array(), - "variables" => array(), - "constants" => array(), - "uses" => array() - ); - - if (isset($this->xml["class"]["inherited"])) { - - if (isset($this->xml["class"]["inherited"][0])) { - - reset($this->xml["class"]["inherited"]); - while (list($k, $inherited)=each($this->xml["class"]["inherited"])) { - - $type = $inherited["type"]; - $src = $inherited["src"]; - - if (isset($inherited["element"][0])) { - - reset($inherited["element"]); - while (list($k2, $element)=each($inherited["element"])) - $this->inherited[$type][$src][] = $element["value"]; - - } else { - - $this->inherited[$type][$src][] = $inherited["element"]["value"]; - - } - - } - - } else { - - $inherited = $this->xml["class"]["inherited"]; - $type = $inherited["type"]; - $src = $inherited["src"]; - - if (isset($inherited["element"][0])) { - - reset($inherited["element"]); - while (list($k, $element)=each($inherited["element"])) - $this->inherited[$type][$src][] = $element["value"]; - - } else { - - $this->inherited[$type][$src][] = $inherited["element"]["value"]; - - } - - } - - unset($this->xml["class"]["inherited"]); - - } - - } // end func buildInheritedlist - - /** - * Builds a list of subclasses - */ - function buildSubclasslist() { - - $this->data["subclasses"] = array(); - - if (isset($this->xml["class"]["subclasses"])) { - - if (isset($this->xml["class"]["subclasses"]["subclass"][0])) { - - reset($this->xml["class"]["subclasses"]["subclass"]); - while (list($k, $subclass)=each($this->xml["class"]["subclasses"]["subclass"])) - $this->data["subclasses"][] = $subclass["value"]; - - } else { - - $this->data["subclasses"][] = $this->xml["class"]["subclasses"]["subclass"]["value"]; - - } - - } - - } // end func buildSubclasslist - - function init() { - - #$this->introspection("xml", $this->xml); - - $this->buildInheritedlist(); - $this->buildSubclasslist(); - - list($this->data["functions"], $this->data["functionsaccess"]) = $this->getElementlist("function"); - list($this->data["variables"], $this->data["variablesaccess"]) = $this->getElementlist("variable"); - list($this->data["constants"], $this->data["constantsaccess"]) = $this->getElementlist("constant"); - - $this->buildUseslist(); - - #$this->introspection("data", $this->data); + /** + * TODO: add documentation + */ + var $xmlkey = "class"; + + /** + * Array of inherited elements + * + * @var array $inherited + */ + var $inherited = array(); + + /** + * Returns an array with the data of a class (no functions etc, just the class +docs). + * + * @return array $class + * @access public + */ + function getClassdata() { + + $class = $this->xml["class"]; + + unset($class["variable"]); + unset($class["function"]); + unset($class["uses"]); + unset($class["constant"]); + unset($class["inherited"]); + unset($class["overriden"]); + unset($class["path"]); + + return $class; + } // end func getClassdata + + /** + * Returns an array of inherited functions. + * + * @return array + * @access public + * @see getInheritedVariables(), getInheritedUses(), getInheritedConstants() + */ + function getInheritedFunctions() { + return $this->inherited["functions"]; + } // end func getInheritedFunctions + + /** + * Returns an array of inherited variables. + * + * @return array + * @access public + * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants() + */ + function getInheritedVariables() { + return $this->inherited["variables"]; + } // end func getInheritedVariables + + /** + * Returns an array of inherited included files. + * + * @return array + * @access public + * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants() + */ + function getInheritedUses() { + return $this->inherited["uses"]; + } // end func getInheritedUses() + + /** + * Returns an array of inherited constants. + * + * @return array + * @access public + * @see getInheritedFunctions(), getInheritedVariables(), getInheritedUses() + */ + function getInheritedConstants() { + return $this->inherited["constants"]; + } // end func getInheritedConstants + + /** + * Returns an array with the "path" of a class. + * + * @return array $path + * @access public + * @see getSubclasses() + */ + function getClasstree() { + + if (isset($this->xml["class"]["path"])) + return $this->convertPath($this->xml["class"]["path"]); + else + return array(); + + } // end func getClasstree + + /** + * Returns an array with all subclasses of a class. + * + * @return array + * @access public + * @see getClasstree() + */ + function getSubclasses() { + return $this->data["subclasses"]; + } // end func getSubclasses + + + /** + * Converts a xml path array to a path that can be passed to the user. + * + * The path is an array like path[0..n] = classname where path[0] is the + * directs parent (extends path[0]) and path[n] is the baseclass. + * + * @param array $xmlpath + * @return array $path + */ + function convertPath($xmlpath) { + + $path = array(); + + if (!isset($xmlpath["parent"][0])) { + + $path[0] = $xmlpath["parent"]["value"]; + + } else { + + reset($xmlpath["parent"]); + while (list($k, $parent) = each($xmlpath["parent"])) + $path[] = $parent["value"]; + + } + + return $path; + } // end func convertPath + + /** + * Builds a list of inherited elements. + * + * @see $inherited + */ + function buildInheritedlist() { + + $this->inherited = array( + "functions" => array(), + "variables" => array(), + "constants" => array(), + "uses" => array() + ); + + if (isset($this->xml["class"]["inherited"])) { + + if (isset($this->xml["class"]["inherited"][0])) { + + reset($this->xml["class"]["inherited"]); + while (list($k, $inherited) = each($this->xml["class"]["inherited"])) +{ + + $type = $inherited["type"]; + $src = $inherited["src"]; + + if (isset($inherited["element"][0])) { + + reset($inherited["element"]); + while (list($k2, $element) = each($inherited["element"])) + $this->inherited[$type][$src][] = $element["value"]; + + } else { + + $this->inherited[$type][$src][] = +$inherited["element"]["value"]; + + } + + } + + } else { + + $inherited = $this->xml["class"]["inherited"]; + $type = $inherited["type"]; + $src = $inherited["src"]; + + if (isset($inherited["element"][0])) { + + reset($inherited["element"]); + while (list($k, $element) = each($inherited["element"])) + $this->inherited[$type][$src][] = $element["value"]; + + } else { + + $this->inherited[$type][$src][] = $inherited["element"]["value"]; + + } + + } + + unset($this->xml["class"]["inherited"]); + + } + + } // end func buildInheritedlist + + /** + * Builds a list of subclasses + */ + function buildSubclasslist() { + + $this->data["subclasses"] = array(); + + if (isset($this->xml["class"]["subclasses"])) { + + if (isset($this->xml["class"]["subclasses"]["subclass"][0])) { + + reset($this->xml["class"]["subclasses"]["subclass"]); + while (list($k, $subclass) = +each($this->xml["class"]["subclasses"]["subclass"])) + $this->data["subclasses"][] = $subclass["value"]; + + } else { + + $this->data["subclasses"][] = +$this->xml["class"]["subclasses"]["subclass"]["value"]; + + } + + } + + } // end func buildSubclasslist + + function init() { + + $this->buildInheritedlist(); + $this->buildSubclasslist(); + + list($this->data["functions"], $this->data["functionsaccess"]) = +$this->getElementlist("function"); + list($this->data["variables"], $this->data["variablesaccess"]) = +$this->getElementlist("variable"); + list($this->data["constants"], $this->data["constantsaccess"]) = +$this->getElementlist("constant"); + + $this->buildUseslist(); - } // end func Init - + } // end func Init + } // end class PhpdocClassAccessor ?> Index: php4/pear/PHPDoc/accessor/PhpdocDocumentAccessor.php diff -u php4/pear/PHPDoc/accessor/PhpdocDocumentAccessor.php:1.2 php4/pear/PHPDoc/accessor/PhpdocDocumentAccessor.php:1.3 --- php4/pear/PHPDoc/accessor/PhpdocDocumentAccessor.php:1.2 Sun Dec 3 13:12:27 2000 +++ php4/pear/PHPDoc/accessor/PhpdocDocumentAccessor.php Sun Feb 18 07:03:05 +2001 @@ -1,249 +1,252 @@ <?php /** * Base of the class and module accessor. +* +* @version $Id: PhpdocDocumentAccessor.php,v 1.3 2001/02/18 15:03:05 uw Exp $ */ class PhpdocDocumentAccessor extends PhpdocAccessor { - /** - * Kind of top-level container in the xml document. - * - * Must be set by all derived classes. - * - * @var string - */ - var $xmlkey = ""; - - /** - * Returns an array with all functions. - * - * @return array $functions - * @access public - * @see getFunctionsByAccess() - */ - function getFunctions() { - return $this->getElements("functions", "functionsaccess"); - } // end func getFunctions - - /** - * Returns an array with all functions with a certain access (public, private) attribute. - * - * @param string Requested access attribute. - * @return array $functions - * @access public - * @see getFunctions() - */ - function getFunctionsByAccess($access) { - return $this->getElementsByAccess($access, "functions", "functionsaccess"); - } // end func getFunctionByAccess - - /** - * Returns an array with all variables. - * - * @return array $variables - * @access public - * @see getVariablesByAccess() - */ - function getVariables() { - return $this->getElements("variables", "variablesaccess"); - } // end func getVariables - - /** - * Returns an array with all variables with a certain access (public, private) attribute. - * - * @param string Requested access attribute. - * @return array $variables - * @access public - * @see getVariables() - */ - function getVariablesByAccess($access) { - return $this->getElementsByAccess($access, "variables", "variablesaccess"); - } // end func getVariablesByAccess - - /** - * Returns an array of all constants. - * - * @return array $constants - * @access public - * @see getConstantsByAccess() - */ - function getConstants() { - return $this->getElements("constants", "constantsaccess"); - } // end func getConstants - - /** - * Returns an array of all constants with a certain access (public, private) attribute. - * - * @param string Requested access attribute. - * @return array $constants - * @see getConstants() - * @access public - */ - function getConstantsByAccess($access) { - return $this->getElementsByAccess($access, "constants", "constantsaccess"); - } // end func getConstantsByAccess - - /** - * Returns an array of all included files. - * - * @return array $uses - * @see getUsesByType() - * @access public - */ - function getUses() { - return $this->getElements("uses", "usestype"); - } // end func getUses - - /** - * Returns an array of all included files with a certain type (include, require...) attribute. - * - * @param string Requested type: include, include_once, require, require_once - * @return array $uses - * @access public - */ - function getUsesByType($type) { - - $data = array(); - - if (!isset($this->data["usestype"][$type])) - return $data; - - reset($this->data["usestype"][$type]); - while (list($k, $file)=each($this->data["usestype"][$type])) { - - $data[$file] = $this->data["uses"][$file]; - if ($this->freeOnGet) - unset($this->data["uses"][$file]); - - } - - if ($this->freeOnGet) - unset($this->data["usestype"][$type]); - - return $data; - } // end func getUsesByType - - /** - * Returns elements from the internal $data array. - * - * The object uses this function to extract functions, variables, uses and - * constants from an internal array. Note that this is not a public function, - * future version might access internal data structures different. - * - * @param string Name of the element you need: functions, variables,... - * @param string Name of internal element access table - * @see $data - */ - function getElements($element, $elementaccess) { - - if ($this->freeOnGet) { - - $data = $this->data[$element]; - unset($this->data[$element]); - unset($this->data[$elementaccess]); - return $data; - - } else { - - $this->data[$element]; - - } - - } // end func getElements - - /** - * Returns elements with a certain access type from the internal data. - * @param string Accesstype - * @param string element name - * @param string access type - * @brother getElements() - */ - function getElementsByAccess($access, $element, $elementaccess) { - - $data = array(); - - if (!isset($this->data[$elementaccess][$access])) - return $data; - - reset($this->data[$elementaccess][$access]); - while (list($k, $name)=each($this->data[$elementaccess][$access])) { - - $data[$name] = $this->data[$element][$name]; - if ($this->freeOnGet) - unset($this->data[$element][$name]); - - } - - if ($this->freeOnGet) - unset($this->data[$elementaccess][$access]); - - return $data; - } // end func getElementsByAccess - - /** - * Adds a list of included files to the internal data array. - */ - function buildUseslist() { - - $this->data["uses"] = array(); - $this->data["usestype"] = array(); - - if (isset($this->xml[$this->xmlkey]["uses"])) { - - if (isset($this->xml[$this->xmlkey]["uses"][0])) { - - reset($this->xml[$this->xmlkey]["uses"]); - while (list($k, $data)=each($this->xml[$this->xmlkey]["uses"])) { - $this->data["uses"][$data["file"]] = $data; - $this->data["usestype"][$data["type"]][] = $data["file"]; - } - - } else { - - $data = $this->xml[$this->xmlkey]["uses"]; - $this->data["uses"][$data["file"]] = $data; - $this->data["usestype"][$data["type"]][] = $data["file"]; - - } - - unset($this->xml[$this->xmlkey]["uses"]); - } - - } // end func buildUseslist - - /** - * Adds a list of a certain element to the internal data array. - * - * @param string name of the element to add: function, variable, constant. - */ - function getElementlist($element) { - - $elements = array(); - $elementaccess = array(); - - if (isset($this->xml[$this->xmlkey][$element])) { - - if (isset($this->xml[$this->xmlkey][$element][0])) { - - reset($this->xml[$this->xmlkey][$element]); - while (list($k, $data)=each($this->xml[$this->xmlkey][$element])) { - $elements[$data["name"]] = $data; - $elementaccess[$data["access"]][] = $data["name"]; - } - - } else { - - $data = $this->xml[$this->xmlkey][$element]; - $elements[$data["name"]] = $data; - $elementaccess[$data["access"]][] = $data["name"]; - - } - - unset($this->xml[$this->xmlkey][$element]); - - } - - return array($elements, $elementaccess); - } // end func getElementlist + /** + * Kind of top-level container in the xml document. + * + * Must be set by all derived classes. + * + * @var string + */ + var $xmlkey = ""; + + /** + * Returns an array with all functions. + * + * @return array $functions + * @access public + * @see getFunctionsByAccess() + */ + function getFunctions() { + return $this->getElements("functions", "functionsaccess"); + } // end func getFunctions + + /** + * Returns an array with all functions with a certain access (public, private) +attribute. + * + * @param string Requested access attribute. + * @return array $functions + * @access public + * @see getFunctions() + */ + function getFunctionsByAccess($access) { + return $this->getElementsByAccess($access, "functions", "functionsaccess"); + } // end func getFunctionByAccess + + /** + * Returns an array with all variables. + * + * @return array $variables + * @access public + * @see getVariablesByAccess() + */ + function getVariables() { + return $this->getElements("variables", "variablesaccess"); + } // end func getVariables + + /** + * Returns an array with all variables with a certain access (public, private) +attribute. + * + * @param string Requested access attribute. + * @return array $variables + * @access public + * @see getVariables() + */ + function getVariablesByAccess($access) { + return $this->getElementsByAccess($access, "variables", "variablesaccess"); + } // end func getVariablesByAccess + + /** + * Returns an array of all constants. + * + * @return array $constants + * @access public + * @see getConstantsByAccess() + */ + function getConstants() { + return $this->getElements("constants", "constantsaccess"); + } // end func getConstants + + /** + * Returns an array of all constants with a certain access (public, private) +attribute. + * + * @param string Requested access attribute. + * @return array $constants + * @see getConstants() + * @access public + */ + function getConstantsByAccess($access) { + return $this->getElementsByAccess($access, "constants", "constantsaccess"); + } // end func getConstantsByAccess + + /** + * Returns an array of all included files. + * + * @return array $uses + * @see getUsesByType() + * @access public + */ + function getUses() { + return $this->getElements("uses", "usestype"); + } // end func getUses + + /** + * Returns an array of all included files with a certain type (include, +require...) attribute. + * + * @param string Requested type: include, include_once, require, require_once + * @return array $uses + * @access public + */ + function getUsesByType($type) { + + $data = array(); + + if (!isset($this->data["usestype"][$type])) + return $data; + + reset($this->data["usestype"][$type]); + while (list($k, $file) = each($this->data["usestype"][$type])) { + + $data[$file] = $this->data["uses"][$file]; + if ($this->freeOnGet) + unset($this->data["uses"][$file]); + + } + + if ($this->freeOnGet) + unset($this->data["usestype"][$type]); + + return $data; + } // end func getUsesByType + + /** + * Returns elements from the internal $data array. + * + * The object uses this function to extract functions, variables, uses and + * constants from an internal array. Note that this is not a public function, + * future version might access internal data structures different. + * + * @param string Name of the element you need: functions, variables,... + * @param string Name of internal element access table + * @see $data + */ + function getElements($element, $elementaccess) { + + if ($this->freeOnGet) { + + $data = $this->data[$element]; + unset($this->data[$element]); + unset($this->data[$elementaccess]); + return $data; + + } else { + + $this->data[$element]; + + } + + } // end func getElements + + /** + * Returns elements with a certain access type from the internal data. + * + * @param string Accesstype + * @param string element name + * @param string access type + * @brother getElements() + */ + function getElementsByAccess($access, $element, $elementaccess) { + + $data = array(); + + if (!isset($this->data[$elementaccess][$access])) + return $data; + + reset($this->data[$elementaccess][$access]); + while (list($k, $name) = each($this->data[$elementaccess][$access])) { + + $data[$name] = $this->data[$element][$name]; + if ($this->freeOnGet) + unset($this->data[$element][$name]); + + } + + if ($this->freeOnGet) + unset($this->data[$elementaccess][$access]); + + return $data; + } // end func getElementsByAccess + + /** + * Adds a list of included files to the internal data array. + */ + function buildUseslist() { + + $this->data["uses"] = array(); + $this->data["usestype"] = array(); + + if (isset($this->xml[$this->xmlkey]["uses"])) { + + if (isset($this->xml[$this->xmlkey]["uses"][0])) { + + reset($this->xml[$this->xmlkey]["uses"]); + while (list($k, $data) = each($this->xml[$this->xmlkey]["uses"])) { + $this->data["uses"][$data["file"]] = $data; + $this->data["usestype"][$data["type"]][] = $data["file"]; + } + + } else { + + $data = $this->xml[$this->xmlkey]["uses"]; + $this->data["uses"][$data["file"]] = $data; + $this->data["usestype"][$data["type"]][] = $data["file"]; + + } + + unset($this->xml[$this->xmlkey]["uses"]); + } + + } // end func buildUseslist + + /** + * Adds a list of a certain element to the internal data array. + * + * @param string name of the element to add: function, variable, constant. + */ + function getElementlist($element) { + + $elements = array(); + $elementaccess = array(); + + if (isset($this->xml[$this->xmlkey][$element])) { + + if (isset($this->xml[$this->xmlkey][$element][0])) { + + reset($this->xml[$this->xmlkey][$element]); + while (list($k, $data) = each($this->xml[$this->xmlkey][$element])) { + $elements[$data["name"]] = $data; + $elementaccess[$data["access"]][] = $data["name"]; + } + + } else { + + $data = $this->xml[$this->xmlkey][$element]; + $elements[$data["name"]] = $data; + $elementaccess[$data["access"]][] = $data["name"]; + + } + + unset($this->xml[$this->xmlkey][$element]); + + } + + return array($elements, $elementaccess); + } // end func getElementlist } // end class PhpdocDocumentAccessor ?> Index: php4/pear/PHPDoc/accessor/PhpdocIndexAccessor.php diff -u php4/pear/PHPDoc/accessor/PhpdocIndexAccessor.php:1.2 php4/pear/PHPDoc/accessor/PhpdocIndexAccessor.php:1.3 --- php4/pear/PHPDoc/accessor/PhpdocIndexAccessor.php:1.2 Sun Dec 3 13:12:27 2000 +++ php4/pear/PHPDoc/accessor/PhpdocIndexAccessor.php Sun Feb 18 07:03:05 2001 @@ -4,356 +4,357 @@ */ class PhpdocIndexAccessor extends PhpdocAccessor { - /** - * Ordered list of all chapternames. - * - * @var array - */ - var $chapternames = array(); - - /** - * Ordered list of all chapters. - * - * @var array - */ - var $chapters = array(); - - /** - * List of all packages. - * - * @var array - */ - var $packages = array(); - - /** - * Data of a classtree - * - * @var array - */ - var $classtree = array(); - - /** - * Data of a modulegroup - * - * @var array - */ - var $modulegroup = array(); - - /** - * Some container withing the packagelist. - * - * @var array - * @see buildPackagelist() - */ - var $packageFields = array("class", "module"); - - /** - * Flag indicating that certain internal datafield have been filled. - * - * @var array - */ - var $flagBuild = array( - "chapter" => false, - "package" => false - ); + /** + * Ordered list of all chapternames. + * + * @var array + */ + var $chapternames = array(); + + /** + * Ordered list of all chapters. + * + * @var array + */ + var $chapters = array(); + + /** + * List of all packages. + * + * @var array + */ + var $packages = array(); + + /** + * Data of a classtree + * + * @var array + */ + var $classtree = array(); + + /** + * Data of a modulegroup + * + * @var array + */ + var $modulegroup = array(); + + /** + * Some container withing the packagelist. + * + * @var array + * @see buildPackagelist() + */ + var $packageFields = array("class", "module"); + + /** + * Flag indicating that certain internal datafield have been filled. + * + * @var array + */ + var $flagBuild = array( + "chapter" => false, + "package" => false + ); - /** - * Returns a modulegroup - * - * @access public - */ - function getModulegroup() { - - $this->buildModulegroup(); - - if ($this->freeOnGet) { - - $data = $this->modulegroup; - $this->modulegroup = array(); - return $data; - - } else { - - return $this->modulegroup; - } - - } // end func getModulegroup - - /** - * Returns a classtree. - * - * @return array - * @access public - */ - function getClasstree() { + /** + * Returns a modulegroup + * + * @access public + */ + function getModulegroup() { + + $this->buildModulegroup(); + + if ($this->freeOnGet) { + + $data = $this->modulegroup; + $this->modulegroup = array(); + return $data; + + } else { + + return $this->modulegroup; + } + + } // end func getModulegroup + + /** + * Returns a classtree. + * + * @return array + * @access public + */ + function getClasstree() { - $this->buildClasstree(); - - if ($this->freeOnGet) { - - $data = $this->classtree; - $this->classtree = array(); - return $data; - - } else { - - return $this->classtree; - - } - - } // end func getClasstree - - /** - * Returns an ordered list of all chapternames. - * - * @return array - * @access public - * @see getChapters() - */ - function getChapternames() { - - $this->buildChapterlist(); - - if ($this->freeOnGet) { - - $data = $this->chapternames; - $this->chapternames = array(); - return $data; - - } else { - - return $this->chapternames; - - } - - } // end func getChapternames - - /** - * Returns an ordered list of all chapters. - * - * @return array - * @access public - * @see getChapternames() - */ - function getChapters() { - - $this->buildChapterlist(); - - if ($this->freeOnGet) { - - $data = $this->chapters; - $this->chapters = array(); - return $data; - - } else { - - return $this->chapters; - - } - - } // end func getChapters - - /** - * Returns a list of all packages - * - * @return array - * @access public - */ - function getPackagelist() { - - $this->buildPackagelist(); + $this->buildClasstree(); + + if ($this->freeOnGet) { + + $data = $this->classtree; + $this->classtree = array(); + return $data; + + } else { + + return $this->classtree; + + } + + } // end func getClasstree + + /** + * Returns an ordered list of all chapternames. + * + * @return array + * @access public + * @see getChapters() + */ + function getChapternames() { + + $this->buildChapterlist(); + + if ($this->freeOnGet) { + + $data = $this->chapternames; + $this->chapternames = array(); + return $data; + + } else { + + return $this->chapternames; + + } + + } // end func getChapternames + + /** + * Returns an ordered list of all chapters. + * + * @return array + * @access public + * @see getChapternames() + */ + function getChapters() { + + $this->buildChapterlist(); + + if ($this->freeOnGet) { + + $data = $this->chapters; + $this->chapters = array(); + return $data; + + } else { + + return $this->chapters; + + } + + } // end func getChapters + + /** + * Returns a list of all packages + * + * @return array + * @access public + */ + function getPackagelist() { + + $this->buildPackagelist(); - if ($this->freeOnGet) { - - $data = $this->packages; - $this->packages = array(); - return $data; - - } else { - - return $this->packages; - - } - - } // end func getPackagelist - - - /** - * Builds the internal packagelist. - */ - function buildPackagelist() { - - if ($this->flagBuild["package"]) - return; - - $data = $this->xml["packagelist"]; - $this->xml = array(); - $this->flagBuild["package"] = true; - - $this->packages = array(); - - if (!isset($data["package"][0])) - $data["package"] = array($data["package"]); - - reset($data["package"]); - while (list($k, $package)=each($data["package"])) { - - $packagename = $package["name"]; - - reset($this->packageFields); - while (list($k, $field)=each($this->packageFields)) { - - if (isset($package[$field][0])) { - - reset($package[$field]); - while (list($k, $element)=each($package[$field])) - $this->packages[$packagename][$field][] = $element["name"]; - - } else if (isset($package[$field])) { - - $this->packages[$packagename][$field][] = $package[$field]["name"]; - - } - } - - } - - } // end func buildPackagelist - - /** - * Builds the internal chapterlists. - */ - function buildChapterlist() { - - if ($this->flagBuild["chapter"]) - return; - - $data = $this->xml["index"]; - $this->xml = array(); - $this->flagBuild["chapter"] = true; + if ($this->freeOnGet) { + + $data = $this->packages; + $this->packages = array(); + return $data; + + } else { + + return $this->packages; + + } + + } // end func getPackagelist + + + /** + * Builds the internal packagelist. + */ + function buildPackagelist() { + + if ($this->flagBuild["package"]) + return; + + $data = $this->xml["packagelist"]; + $this->xml = array(); + $this->flagBuild["package"] = true; + + $this->packages = array(); + + if (!isset($data["package"][0])) + $data["package"] = array($data["package"]); + + reset($data["package"]); + while (list($k, $package) = each($data["package"])) { + + $packagename = $package["name"]; + + reset($this->packageFields); + while (list($k, $field) = each($this->packageFields)) { + + if (isset($package[$field][0])) { + + reset($package[$field]); + while (list($k, $element)=each($package[$field])) + $this->packages[$packagename][$field][] = $element["name"]; + + } else if (isset($package[$field])) { + + $this->packages[$packagename][$field][] = +$package[$field]["name"]; + + } + } + + } + + } // end func buildPackagelist + + /** + * Builds the internal chapterlists. + */ + function buildChapterlist() { + + if ($this->flagBuild["chapter"]) + return; + + $data = $this->xml["index"]; + $this->xml = array(); + $this->flagBuild["chapter"] = true; - $this->chapternames = array(); - $this->chapters = array(); - - if (isset($data["chapter"][0])) { - - $chapterlist = array(); - reset($data["chapter"]); - while (list($k, $chapter)=each($data["chapter"])) - $chapterlist[strtoupper($chapter["char"])][$chapter["char"]] = $k; - - ksort($chapterlist, SORT_STRING); - - reset($chapterlist); - while (list($k, $chapters)=each($chapterlist)) { - - reset($chapters); - while (list($chapter, $index)=each($chapters)) { - $this->chapternames[] = $chapter; - $this->chapters[$chapter] = $data["chapter"][$index]; - } - - } - - } else { - - $this->chapternames[] = $data["chapter"]["char"]; - $this->chapters[$data["chapter"]["char"]] = $data["chapter"]["char"]; - - } - - } // end func buildChapterlist + $this->chapternames = array(); + $this->chapters = array(); + + if (isset($data["chapter"][0])) { + + $chapterlist = array(); + reset($data["chapter"]); + while (list($k, $chapter) = each($data["chapter"])) + $chapterlist[strtoupper($chapter["char"])][$chapter["char"]] = $k; + + ksort($chapterlist, SORT_STRING); + + reset($chapterlist); + while (list($k, $chapters) = each($chapterlist)) { + + reset($chapters); + while (list($chapter, $index)=each($chapters)) { + $this->chapternames[] = $chapter; + $this->chapters[$chapter] = $data["chapter"][$index]; + } + + } + + } else { + + $this->chapternames[] = $data["chapter"]["char"]; + $this->chapters[$data["chapter"]["char"]] = $data["chapter"]["char"]; + + } + + } // end func buildChapterlist - /** - * Extracts the modulegroup data of the xml file. - * - * @see getModulegroup() - */ - function buildModulegroup() { - - if ($this->flagBuild["modulegroup"]) - return; - - $this->flagBuild["modulegroup"] = true; - $data = $this->xml["modulegroup"]; - - $this->xml = ""; - $this->modulegroup = array( - "group" => $data["name"], - "modules" => array() - ); - - if (!isset($data["module"][0])) - $data["module"] = array( $data["module"] ); - - reset($data["module"]); - while (list($k, $module)=each($data["module"])) - $this->modulegroup["modules"][] = $module["name"]; - - } // end func buildModulegroup - - /** - * Extracts the classtree data of the xml file. - * - * @see getClasstree() - */ - function buildClasstree() { - - if ($this->flagBuild["classtree"]) - return; - - $this->flagBuild["classtree"] = true; - $data = $this->xml["classtree"]; - $this->xml = ""; - - $this->classtree = array( - "baseclass" => $data["baseclass"], - "classes" => array() - ); - - if (!isset($data["class"][0])) - $data["class"] = array( $data["class"] ); + /** + * Extracts the modulegroup data of the xml file. + * + * @see getModulegroup() + */ + function buildModulegroup() { + + if ($this->flagBuild["modulegroup"]) + return; + + $this->flagBuild["modulegroup"] = true; + $data = $this->xml["modulegroup"]; + + $this->xml = ""; + $this->modulegroup = array( + "group" => $data["name"], + "modules" => array() + ); + + if (!isset($data["module"][0])) + $data["module"] = array( $data["module"] ); + + reset($data["module"]); + while (list($k, $module) = each($data["module"])) + $this->modulegroup["modules"][] = $module["name"]; + + } // end func buildModulegroup + + /** + * Extracts the classtree data of the xml file. + * + * @see getClasstree() + */ + function buildClasstree() { + + if ($this->flagBuild["classtree"]) + return; + + $this->flagBuild["classtree"] = true; + $data = $this->xml["classtree"]; + $this->xml = ""; + + $this->classtree = array( + "baseclass" => $data["baseclass"], + "classes" => array() + ); + + if (!isset($data["class"][0])) + $data["class"] = array( $data["class"] ); - reset($data["class"]); - while (list($k, $class)=each($data["class"])) { - - if (!isset($class["subclass"])) { - - $this->classtree["classes"][$class["name"]] = array(); - - } else { - - if (!isset($class["subclass"][0])) { - - $this->classtree["classes"][$class["name"]][] = $class["subclass"]["value"]; - - } else { - - reset($class["subclass"]); - while (list($k, $subclass)=each($class["subclass"])) - $this->classtree["classes"][$class["name"]][] = $subclass["value"]; - - } - - } - - } - - } // end func buildClasstree - - /** - * Resets the build flags. - * @see $flagBuild - */ - function init() { - - reset($this->flagBuild); - while (list($k, $v)=each($this->flagBuild)) - $this->flagBuild[$k] = false; - - } // end func init + reset($data["class"]); + while (list($k, $class)=each($data["class"])) { + + if (!isset($class["subclass"])) { + + $this->classtree["classes"][$class["name"]] = array(); + + } else { + + if (!isset($class["subclass"][0])) { + + $this->classtree["classes"][$class["name"]][] = +$class["subclass"]["value"]; + + } else { + + reset($class["subclass"]); + while (list($k, $subclass)=each($class["subclass"])) + $this->classtree["classes"][$class["name"]][] = +$subclass["value"]; + + } + + } + + } + + } // end func buildClasstree + + /** + * Resets the build flags. + * + * @see $flagBuild + */ + function init() { + + reset($this->flagBuild); + while (list($k, $v) = each($this->flagBuild)) + $this->flagBuild[$k] = false; + + } // end func init - + } // end class PhpdocIndexAccessor ?> Index: php4/pear/PHPDoc/accessor/PhpdocModuleAccessor.php diff -u php4/pear/PHPDoc/accessor/PhpdocModuleAccessor.php:1.1 php4/pear/PHPDoc/accessor/PhpdocModuleAccessor.php:1.2 --- php4/pear/PHPDoc/accessor/PhpdocModuleAccessor.php:1.1 Sun Oct 8 03:03:18 2000 +++ php4/pear/PHPDoc/accessor/PhpdocModuleAccessor.php Sun Feb 18 07:03:05 2001 @@ -1,35 +1,38 @@ <?php /** * Provides functions to access phpdoc xml documents that contain modules. +* +* @version $Id: PhpdocModuleAccessor.php,v 1.2 2001/02/18 15:03:05 uw Exp $ */ class PhpdocModuleAccessor extends PhpdocDocumentAccessor { - - var $xmlkey = "module"; - - /** - * Returns an array with the data of a module (no functions etc, just the module docs). - * @return array $class - * @access public - */ - function getModuledata() { - - $module = $this->xml["module"]; + + var $xmlkey = "module"; + + /** + * Returns an array with the data of a module (no functions etc, just the module +docs). + * + * @return array $class + * @access public + */ + function getModuledata() { + + $module = $this->xml["module"]; - unset($module["function"]); - unset($module["uses"]); - unset($module["constant"]); - - return $module; - } // end func getModuledata - - function init() { + unset($module["function"]); + unset($module["uses"]); + unset($module["constant"]); + + return $module; + } // end func getModuledata + + function init() { - list($this->data["functions"], $this->data["functionsaccess"]) = $this->getElementlist("function"); - list($this->data["variables"], $this->data["variablesaccess"]) = $this->getElementlist("variable"); - list($this->data["constants"], $this->data["constantsaccess"]) = $this->getElementlist("constant"); - $this->buildUseslist(); + list($this->data["functions"], $this->data["functionsaccess"]) = +$this->getElementlist("function"); + list($this->data["variables"], $this->data["variablesaccess"]) = +$this->getElementlist("variable"); + list($this->data["constants"], $this->data["constantsaccess"]) = +$this->getElementlist("constant"); + $this->buildUseslist(); - } // end func Init - + } // end func Init + } // end class PhpdocModuleAccessor ?> Index: php4/pear/PHPDoc/accessor/PhpdocWarningAccessor.php diff -u php4/pear/PHPDoc/accessor/PhpdocWarningAccessor.php:1.1 php4/pear/PHPDoc/accessor/PhpdocWarningAccessor.php:1.2 --- php4/pear/PHPDoc/accessor/PhpdocWarningAccessor.php:1.1 Sun Oct 8 03:03:18 2000 +++ php4/pear/PHPDoc/accessor/PhpdocWarningAccessor.php Sun Feb 18 07:03:05 2001 @@ -2,88 +2,92 @@ /** * Extracts the warnings from PHPDoc warnings_* files. * +* @version $Id: PhpdocWarningAccessor.php,v 1.2 2001/02/18 15:03:05 uw Exp $ */ class PhpdocWarningAccessor extends PhpdocAccessor { - /** - * If set to true all get_xy() functions will free their resources. - * @var boolean - * @access public - */ - var $freeOnGet = true; - - /** - * Array of warnings. - * @var array - */ - var $warnings = array(); - - /** - * Flag used to detect if get_xy() was called.s - * @var boolean - */ - var $flag_build = false; - - /** - * Returns a hash of warnings in of the given XML file. - * - * @param string XML file - * @return array - * @access public - * @see $freeOnGet - */ - function getWarnings($xmlfile) { - - $this->buildWarnings($xmlfile); - - if ($this->freeOnGet) { - - $data = $this->warnings; - $this->warnings = array(); - return $data; - - } else { - - return $this->warnings; - - } - - } // end func getWarnings - - /** - * Build the internal list of warnings. - * - * @param string XML file to load - */ - function buildWarnings($xmlfile) { - - if ($this->flag_build) - return; - - $this->flag_build = true; - $this->warnings = array(); - $this->loadXMLFile($xmlfile); + /** + * If set to true all get_xy() functions will free their resources. + * + * @var boolean + * @access public + */ + var $freeOnGet = true; + + /** + * Array of warnings. + * + * @var array + */ + var $warnings = array(); + + /** + * Flag used to detect if get_xy() was called. + * + * @var boolean + */ + var $flag_build = false; + + /** + * Returns a hash of warnings in of the given XML file. + * + * @param string XML file + * @return array + * @access public + * @see $freeOnGet + */ + function getWarnings($xmlfile) { + + $this->buildWarnings($xmlfile); + + if ($this->freeOnGet) { + + $data = $this->warnings; + $this->warnings = array(); + return $data; + + } else { + + return $this->warnings; + + } + + } // end func getWarnings + + /** + * Build the internal list of warnings. + * + * @param string XML file to load + */ + function buildWarnings($xmlfile) { + + if ($this->flag_build) + return; + + $this->flag_build = true; + $this->warnings = array(); + $this->loadXMLFile($xmlfile); - if(!isset($this->xml["warnings"][0])) - $this->xml["warnings"] = array( $this->xml["warnings"] ); - - reset($this->xml["warnings"]); - while (list($k, $warnings)=each($this->xml["warnings"])) { - - $file = $warnings["file"]; - if (!isset($warnings["warning"][0])) - $warnings["warning"] = array($warnings["warning"]); - $this->warnings[$file] = $warnings["warning"]; - - } + if(!isset($this->xml["warnings"][0])) + $this->xml["warnings"] = array( $this->xml["warnings"] ); + + reset($this->xml["warnings"]); + while (list($k, $warnings) = each($this->xml["warnings"])) { + + $file = $warnings["file"]; + if (!isset($warnings["warning"][0])) + $warnings["warning"] = array($warnings["warning"]); + $this->warnings[$file] = $warnings["warning"]; + + } - $this->xml = ""; - - } // end func buildWarnings - - function init() { - $this->flag_build = false; - } // end func init - + $this->xml = ""; + + } // end func buildWarnings + + function init() { + $this->flag_build = false; + } // end func init + } // end class PhpdocWarningAccess ?>
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]