Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: c:/www/apache/doc2//parser/PhpdocParser.php
PHPDOC 2000/12/03 - PHPDoc

PhpdocParser

PhpdocObject
   |
  +-- PhpdocParserRegExp
     |
    +-- PhpdocParserTags
       |
      +-- PhpdocParserCore
         |
        +-- PhpdocUseParser
           |
          +-- PhpdocConstantParser
             |
            +-- PhpdocModuleParser
               |
              +-- PhpdocVariableParser
                 |
                +-- PhpdocFunctionParser
                   |
                  +-- PhpdocClassParser
                     |
                    +-- PhpdocParser

"Main" class of the Parser collection.

 

private class PhpdocParser extends PhpdocClassParser

"Main" class of the Parser collection.
Note that a lot of communication is done using shared instance variables.

AuthorsUlf Wendel <ulf.wendel@redsys.de>
Version$Id: $

 

Methods inherited from PhpdocClassParser

analyseclass, analyseclassdoc

Methods inherited from PhpdocFunctionParser

analysefunction, getfunctionargs

Methods inherited from PhpdocVariableParser

analysevariable, checkvardocs

Methods inherited from PhpdocModuleParser

analysemodule, analysemoduledoc

Methods inherited from PhpdocConstantParser

analyseconstant, checkconstantdoc

Methods inherited from PhpdocUseParser

analyseuse

Methods inherited from PhpdocParserCore

getphpdocparagraphs, getmodulesandclasses, getmoduledoc, getclasses, extractphpdoc, getdescription, getvalue, getvariabletypeandvalue

Methods inherited from PhpdocParserTags

analysetags, analyseseetagregs, gettags, gettagpos, checkparsererrors

Methods inherited from PhpdocParserRegExp

buildcomplexregexps

Methods inherited from PhpdocObject

setflagoutput, out, nametourl, outl, introspection

Public Method Summary

void

PhpdocParser([ boolean $flag_output ])

Creates an instance of PhpdocWarning and calls buildComplexRegExps() to initialize the object.
boolean

preparse()

Central parsing function.
mixed

getClassTree()

Returns the data of one parentclass and all it's subclasses or false.
mixed

getModulegroup()

Returns the data of one module group.
bool

setPhpSourcecodeFiles(array $phpfiles)

Sets the list of PHP Soucecode Files to examine.

Private Method Summary

void

addModule(string $group, string $filename)

Analyses the given file and adds the result to the module list.
void

addClass(string $classname, string $filename)

Analyses the given file and adds the result to the class list.
void

addSubclasses(string $classname)

Adds recursively subclasses to the specified class.
void

findModulegroups(array $para)

Builds the hash of module groups and the module file list.
void

findClassTrees(array $para)

Builds a hash of all class trees.
array

getClassnamesToFilenames()

Returns the mapping array from classnames to filenames

Fields inherited from PhpdocClassParser

$emptyclass, $classtags

Fields inherited from PhpdocFunctionParser

$emptyfunction, $functiontags

Fields inherited from PhpdocVariableParser

$emptyvariable, $variabletags

Fields inherited from PhpdocModuleParser

$emptymodule, $moduletags

Fields inherited from PhpdocConstantParser

$emptyconstant, $constanttags

Fields inherited from PhpdocUseParser

$emptyuse, $usetags

Fields inherited from PhpdocParserRegExp

$phpdoc_tags, $c_base, $c_complex, $php_base, $php_complex, $tags

Fields inherited from PhpdocObject

$err, $application, $warn, $flag_output

Private Field Summary

string

$currentFile

Name of the file currently parsed.
array

$phpfiles

Array of PHP Sourcecode Files to examine.
array

$classnamesToFilenames

Mapping from classnames to filenames
array

$classes

Hash with the data of the current class tree (one parentclass with all children).
array

$baseclasses

List of all parentclasses found.
array

$classfiles

List of all files containing classes.
array

$classtree

Hash of all class trees.
array

$modulefiles

List of all files containing modules.
array

$modulegroups

List of all module groups.
array

$modules

Hash with the data of the current module group.
array

$packages

Hash of all packages found.
boolean

$flag_classtree

Flag indicating that getClassTree() was called.
boolean

$flag_modulegroup

Flag indicating that getModulegroup was called.
string

$current_baseclass

Name of the base class of the current class tree.

Public Method Details

PhpdocParser

public void PhpdocParser( [ boolean $flag_output ] )

  Creates an instance of PhpdocWarning and calls buildComplexRegExps() to initialize the object.

Parameter
boolean $flag_output = >>false<<
true the parser prints status messages.
Returns void


preparse

public boolean preparse( )

  Central parsing function.
With version 0.3alpha PHPdoc changed the way the parser works. It does now1 1/2 parsing runs. One prescan to build the class trees and a list of modulegroups and one deep scan to extract the information. This reduces the memoryconsumption.

Returns boolean $ok

See Also findModulegroups(), findClassTrees()

getClassTree

public mixed getClassTree( )

  Returns the data of one parentclass and all it's subclasses or false.
Use this function to loop through the class trees. The loop should look somewhat like:<code>while ( $classtree = $parser->getClassTree() ) ...</code>

Returns mixed $classes

Hash with the data of the current class tree or false.

See Also getModulegroup(), $baseclasses

getModulegroup

public mixed getModulegroup( )

  Returns the data of one module group.
Use this function to loop through the module groups. The loop should look somewhat like:<code>while ( $modulegroup = $parser->getModulegroup() ) ...</code>.

Returns mixed $modulegroup

Hash with the data of the current class tree or false.

See Also getClassTree(), addModule(), $modulegroups

setPhpSourcecodeFiles

public bool setPhpSourcecodeFiles( array $phpfiles )

  Sets the list of PHP Soucecode Files to examine.

Parameter
array $phpfiles
Returns bool $ok


Private Method Details

addModule

private void addModule( string $group, string $filename )

  Analyses the given file and adds the result to the module list.
The function analyses the given file, unsets the file in thefile list, adds the result of the parser to the module list andif necessary it adds some data to the package list.

Parameter
string $group
of the module group the parsing result gets added.
string $filename
of the file to scan.
Returns void


addClass

private void addClass( string $classname, string $filename )

  Analyses the given file and adds the result to the class list.
The first parameter (classname) comes from the prescan doneby findClassTrees()

Parameter
string $classname
of the class that gets added.
string $filename
of the file to scan.
Returns void

See Also addSubclasses(), $classes

addSubclasses

private void addSubclasses( string $classname )

  Adds recursively subclasses to the specified class.

Parameter
string $classname
of the class that might contain subclasses
Returns void

See Also addClass()

findModulegroups

private void findModulegroups( array $para )

  Builds the hash of module groups and the module file list.

Parameter
array $para
with the result of getClassesAndModules() of all files
Returns void

See Also $modulegroups, $modulefiles

findClassTrees

private void findClassTrees( array $para )

  Builds a hash of all class trees.

Parameter
array $para
with the result of getClassesAndModules() of all files
Returns void

See Also findModulegroups(), $classnamesToFilenames, $classtree, $classfiles, $baseclasses

getClassnamesToFilenames

private array getClassnamesToFilenames( )

  Returns the mapping array from classnames to filenames

Returns array

See Also $classnamesToFilenames

Private Field Details

$currentFile

private string $currentFile

>>""<<

Name of the file currently parsed.
Instead of passing the name of the current file by argumentPHPDoc uses this slot to communicate. Yeah I know, it'sthe way methods should communicate, but it saves me a lota lot of work.


$phpfiles

private array $phpfiles

>>array()<<

Array of PHP Sourcecode Files to examine.
The array keys hold the filenames, the array values the file content.


$classnamesToFilenames

private array $classnamesToFilenames

>>array()<<

Mapping from classnames to filenames


$classes

private array $classes

>>array()<<

Hash with the data of the current class tree (one parentclass with all children).

See Also $modules

$baseclasses

private array $baseclasses

>>array()<<

List of all parentclasses found.


$classfiles

private array $classfiles

>>array()<<

List of all files containing classes.


$classtree

private array $classtree

>>array()<<

Hash of all class trees.


$modulefiles

private array $modulefiles

>>array()<<

List of all files containing modules.


$modulegroups

private array $modulegroups

>>array()<<

List of all module groups.


$modules

private array $modules

>>array()<<

Hash with the data of the current module group.

See Also $classes

$packages

private array $packages

>>array()<<

Hash of all packages found.


$flag_classtree

private boolean $flag_classtree

>>false<<

Flag indicating that getClassTree() was called.

See Also getClassTree()

$flag_modulegroup

private boolean $flag_modulegroup

>>false<<

Flag indicating that getModulegroup was called.

See Also getModulegroup()

$current_baseclass

private string $current_baseclass

>>""<<

Name of the base class of the current class tree.

See Also getClassTree()


Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta