Class Classes

Description

Intermediate class parsing structure.

The phpDocumentor_IntermediateParser class uses this class and its cousin, ProceduralPages to organize all parsed source code elements. Data is fed to each immediately after it is parsed, and at conversion time, everything is organized.

The Classes class is responsible for all inheritance, including resolving name conflicts between classes, determining which classes extend other classes, and is responsible for all inheritance of documentation.

Located in /phpDocumentor/Classes.inc (line 70)


	
			
Method Summary
 void addClass (parserClass &$element)
 void addConst (parserConst &$element)
 void addMethod (parserMethod &$element)
 void addPackageToFile (string $package)
 void addVar (parserVar &$element)
 parserClass &getClass (string $class, string $file)
 mixed &getClassByPackage (string $class, string $package)
 mixed getClassesInPath (string $path)
 mixed getConflicts (mixed $class)
 mixed getDefiniteChildren (string $parclass, string $file)
 mixed getParentClass (string $class, string $file)
 array getRoots ([boolean $all = false])
 void nextFile (string $file)
 void processChild (phpDocumentor_IntermediateParser &$render, string $class, string $file, [boolean $furb = false])
 void setClassParent (string $class, string $file)
Methods
addClass (line 393)

While parsing, add a class to the list of parsed classes

sets up the $classesbyfile, $classesbynamefile, $extendsbyfile, $classchildrenbyfile, $roots arrays, and sets $curclass

void addClass (parserClass &$element)
addConst (line 466)

While parsing, add a variable to the list of parsed variables

sets up the $constsbyfile array using $curfile and $curclass

void addConst (parserConst &$element)
addMethod (line 434)

While parsing, add a method to the list of parsed methods

sets up the $methodsbyfile array using $curfile and $curclass

void addMethod (parserMethod &$element)
addPackageToFile (line 497)

Mark a package as being used in a class

  1. function addPackageToFile($package)
  2.     {
  3.         if (!isset($this->revcpbf[$this->curfile][$package]))
  4.         $this->classpackagebyfile[$this->curfile][$package;
  5.         $this->revcpbf[$this->curfile][$package]    1;
  6.     }

void addPackageToFile (string $package)
  • string $package: package name
addVar (line 450)

While parsing, add a variable to the list of parsed variables

sets up the $varsbyfile array using $curfile and $curclass

void addVar (parserVar &$element)
getClass (line 943)

Get the parserClass representation of a class from its name and file

parserClass &getClass (string $class, string $file)
  • string $class: classname
  • string $file: file classname is located in
getClassByPackage (line 1189)

Search for a class in a package

  • return: returns false if no class in $package, otherwise returns a parserClass
mixed &getClassByPackage (string $class, string $package)
  • string $class: classname
  • string $package: package classname is in
getClassesInPath (line 960)

Used by parserData::getClasses() to retrieve classes defined in file $path

retrieves the array entry from $classesbyfile for $path

  • return: returns false if no classes defined in the file, otherwise returns an array of parserClasses
mixed getClassesInPath (string $path)
  • string $path: full path to filename
getConflicts (line 630)

If a package contains two classes with the same name, this function finds that conflict

Returns the $classconflicts entry for class $class, minus its own path

  • return: returns false if no conflicts, or an array of paths containing conflicts
mixed getConflicts (mixed $class)
  • mixed $class: the class name to search for
getDefiniteChildren (line 1349)

Get all classes confirmed in parsing to be descended class $parclass in file $file

  • return: either false if no children, or array of format array(childname => childfile,childname2 => childfile2,...)
  • see: parserClass::getChildClassList()
  • uses: $definitechild
mixed getDefiniteChildren (string $parclass, string $file)
  • string $parclass: name of parent class
  • string $file: file parent class is found in
getParentClass (line 1227)

Find the parent class of a class in file $file

uses 3 tests to find the parent classname:

  1. only one class with the parent classname
  2. more than one class, but only one in the same file as the child
  3. only one parent class in the same package as the child

  • return: false if no parent class, a string if no parent class found by that name, and an array(file parentclass is in, parentclassname)
  • usedby: Classes::setClassParent() - to find the parent class
mixed getParentClass (string $class, string $file)
  • string $class: classname
  • string $file: file classname is located in
getRoots (line 1292)

Get a list of all root classes indexed by package. Used to generate class trees by Converter

  • return: array(package => array(rootclassname, rootclassname,...),...)
array getRoots ([boolean $all = false])
  • boolean $all: [since phpDocumentor 1.3.0RC6] determines whether to return class trees that extend non-parsed classes
Inherit (line 546)

Main processing engine for setting up class inheritance.

This function uses $roots to traverse the inheritance tree via processChild() and returns the data structures phpDocumentor_IntermediateParser needs to convert parsed data to output using phpDocumentor_IntermediateParser::Convert()

  • todo: CS Cleanup - rename to "inherit" for CamelCaps naming standard
  • uses: Classes::processChild() - set up inheritance
void Inherit (phpDocumentor_IntermediateParser &$render)
nextFile (line 482)

Prepare to parse a new file

sets $curfile to $file and $curclass to false (no class being parsed)

void nextFile (string $file)
  • string $file: file currently being parsed
processChild (line 690)

This function recursively climbs up the class tree, setting inherited information like package and adds the elements to phpDocumentor_IntermediateParser.

Using structures defined in Classes, the function first sets package information, and then seeks out child classes. It uses 3 tests to determine whether a class is a child class.

  1. child class is in the same file as the parent class and extends parent class
  2. child class is in a different file and specifies the parent's @package in its docblock
  3. child class is in a different file and is in a different @package, with one possible parent class

void processChild (phpDocumentor_IntermediateParser &$render, string $class, string $file, [boolean $furb = false])
  • phpDocumentor_IntermediateParser &$render: the renderer object
  • string $class: class to process
  • string $file: name of file $class is located in
  • boolean $furb: flag used privately to control informational output while parsing (used when processing leftover classes in Inherit()
setClassParent (line 518)

Find the parent class of $class, and set up structures to note this fact

Modifies the parserClass element in $classesbyfile to use the parent's package, and inherit methods/vars

  • uses: Classes::getParentClass() - to find the parent class
  • uses: $definitechild - if a match is made between a parent class and parameter $class in file $file, then definitechild is set here
void setClassParent (string $class, string $file)
  • string $class: child class to find parent class
  • string $file: file child class is located in

Documentation generated on Mon, 05 Dec 2011 21:02:40 -0600 by phpDocumentor 1.4.4