Inherited Variables
Inherited Constants
Inherited Methods
Class Details
The phpDocumentor_IntermediateParser Class
This class performs the work of organizing raw data from the parser in the format of descendants of the parserElement class. This is also where processing of package pages occurs, in phpDocumentor_IntermediateParser::handleClass() for class-level packages and phpDocumentor_IntermediateParser::handleDocBlock() for page-level packages.
Most of the work of this parser goes to matching up DocBlocks with the elements that they are documenting. Since DocBlocks are passed before the element they document, the last DocBlock is stored in phpDocumentor_IntermediateParser::$last and then placed into the $docblock parameter of the parserElement descendant object.
Tags:
- author - Gregory Beaver
- version - $Id: IntermediateParser.inc 317234 2011-09-24 05:03:55Z ashnazg $
- copyright - 2002 Gregory Beaver
[ Top ]
Class Variables
$all_packages = array()
[line 186]
list of all packages encountered while documenting. Used in automatic linking.
Converter::getLink() first checks if an ambiguous link is found in the current package. If not, it then checks in parent packages, and if still not found, uses this array to check in the rest of the packages before giving up
Tags:
- var - Format: array(packagename => 1, packagename => 1,...)
- see - Converter::getLink()
Type: array
Overrides:
[ Top ]
$classes = false
[line 268]
used to keep track of inheritance at the smartest level possible for a
dumb computer
Type: Classes
Overrides:
[ Top ]
$converters = false
[line 287]
an array of template names indexed by converter name
For example, if the default HTMLframesConverter is using the DOM/l0l33t template, the array will be
- $converters['frames'] = 'DOM/l0l33t'
Tags:
- var - Format: array(Convertername1 => templatename)
- see - Converter
Type: array
Overrides:
[ Top ]
$cur_class = ''
[line 88]
Name of the class currently being parsed.
It is only used (and only valid) when phpDocumentor_IntermediateParser is parsing a class
Type: string
Overrides:
[ Top ]
$data
[line 237]
$data contains parsed structures for the current page being parsed
In version 1.1+, $data is only used to store the current page information. All handling of documented elements is handled by the ProceduralPages and Classes classes.
Type: parserData
Overrides:
[ Top ]
$db_template
[ Top ]
$event_handlers = array(
'docblock' => 'handleDocBlock',
'page' => 'handlePage',
'class' => 'handleClass',
'define' => 'handleDefine',
'function' => 'handleFunction',
'method' => 'handleMethod',
'var' => 'handleVar',
'const' => 'handleConst',
'packagepage' => 'handlePackagePage',
'include' => 'handleInclude',
'global' => 'handleGlobal',
'tutorial' => 'handleTutorial',
)
[line 214]
the functions which handle output from the Parser
Tags:
- see - phpDocumentor_IntermediateParser::handlePackagePage(), phpDocumentor_IntermediateParser::handleInclude(), phpDocumentor_IntermediateParser::handleTutorial()
- see - phpDocumentor_IntermediateParser::handleDefine(), phpDocumentor_IntermediateParser::handleFunction(), phpDocumentor_IntermediateParser::handleMethod(), phpDocumentor_IntermediateParser::handleVar()
- see - handleEvent(), phpDocumentor_IntermediateParser::handleDocBlock(), phpDocumentor_IntermediateParser::handlePage(), phpDocumentor_IntermediateParser::handleClass()
Type: mixed
Overrides:
[ Top ]
$last
[ Top ]
$lasttype = ''
[line 80]
type of the last parser Element handled
This is used in handleDocBlock to determine whether a DocBlock is a page-level DocBlock in conjunction with the parserData::$clean var. A page-level DocBlock is alwaysthe first DocBlock in a file, and must be followed by another DocBlock. The first test is handled by parserData::$clean, which is set to false on the first encounter of an element, and the second test is handled by this variable, which must be equal to "docblock"
Tags:
Type: string
Overrides:
[ Top ]
$packagecategories = array()
[line 173]
Used to determine the category for tutorials.
WARNING: If more than one category exists, the last category encountered will overwrite the previous and will raise a big warning
Tags:
- var - Format: packagename => categoryname
Type: array
Overrides:
[ Top ]
$packageoutput = false
[line 206]
array of packages to parser and output documentation for, if not all packages should be documented
Format:
array(package1,package2,...)
or false if not set
Use this option to limit output similar to ignoring files. If you have some temporary files that you don't want to specify by name but don't want included in output, set a package name for all the elements in your project, and set packageoutput to that name. the default package will be ignored. Parsing speed does not improve. If you want to ignore files for speed reasons, use the ignore command-line option
Tags:
- tutorial - -po, --packageoutput
- see - Io
Type: false|array
Overrides:
[ Top ]
$package_pages = array()
[line 133]
array of parsed package pages
used by Convert() to convert all package pages into output
Type: array
Overrides:
[ Top ]
$package_parents = array()
[line 164]
Keeps track of packages of classes that have parent classes in another package. Used in automatic linking.
This array is updated by addPackageParent(), which is called in Classes::processChild() to keep track of classes that descend from classes in different packages. In other words, if class foo is in package one, and class bar is in package two, an entry $package_parents['two'] = 'one' will be made.
Tags:
- var - Format: packagename => parentpackagename
- see - Converter::getLink()
Type: array
Overrides:
[ Top ]
$pages = array()
[ Top ]
$parsePrivate = false
[line 106]
set in Setup.inc.php to the value of the parseprivate commandline
option. If this option is true, elements with an @access private tag will be parsed and displayed
Tags:
- tutorial - -pp, --parseprivate
Type: boolean
Overrides:
[ Top ]
$privatepages = array()
[line 151]
Put away a page that has been @ignored or @access private if !$parsePrivate
When a page has @access private in its DocBlock, it is placed here instead of in $pages, to allow for proper Class parsing. Since classes and pages are parsed as if they were separate, this array allows public classes on private pages to retrieve information needed about the page that holds the class and to addPageIfNecessary() to the $pages array
Type: array
Overrides:
[ Top ]
$private_class = false
[line 113]
this variable is used to prevent parsing of elements with an @ignore tag
Tags:
- see - phpDocumentor_IntermediateParser::$parsePrivate
- see - phpDocumentor_IntermediateParser::$packageoutput
Type: mixed
Overrides:
[ Top ]
$proceduralpages = false
[line 276]
used to keep track of all elements in a procedural page. Handles name
conflicts with elegance
Tags:
- since - 1.1
Type: ProceduralPages
Overrides:
[ Top ]
$quietMode = false
[line 248]
set in Setup.inc.php to the value of the quitemode commandline option.
If this option is true, informative output while parsing will not be displayed (documentation is unaffected)
Tags:
- tutorial - -q, --quiet
Type: boolean
Overrides:
[ Top ]
$ric = array()
[line 303]
Stores parsed CHANGELOG/INSTALL/README files
Tags:
- var - Format: array(CHANGELOG => contents, INSTALL => contents, README => contents)
Type: array
Overrides:
[ Top ]
$targetDir
[ Top ]
$templateBase
[ Top ]
$title = ''
[line 291]
Tags:
- var - Title of generated documentation, passed to Converters
Type: string
Overrides:
[ Top ]
$type = ''
[line 97]
type of the current parser Element being handled
This is used by HandleEvent() to set the $lasttype var, which is used to detect page-level DocBlocks
Type: string
Overrides:
[ Top ]
$undocumentedElementWarnings = false
[line 261]
set in Setup.inc.php to the value of the undocumentedElementWarnings commandline option.
If this option is true, warnings about certain elements (classes, methods) that are not documented with DocBlocks will be shown while parsing, and will also be displayed in the errors.html page (other documentation is unaffected)
Tags:
- tutorial - -ue, --undocumentedelements
Type: boolean
Overrides:
[ Top ]
$uses = array()
[ Top ]
Class Methods
phpDocumentor_IntermediateParser
phpDocumentor_IntermediateParser phpDocumentor_IntermediateParser(
[string
$title = 'Generated Documentation'])
[line 326]
sets up basic data structures
Tags:
- see - phpDocumentor_IntermediateParser::$title, phpDocumentor_IntermediateParser::$data, phpDocumentor_IntermediateParser::$classes, phpDocumentor_IntermediateParser::$proceduralpages
Parameters:
- string $title - Title of generated documentation, passed to Converters
[ Top ]
addConverter
void addConverter(
string
$output, string
$name, string
$template)
[line 1710]
Add a converter name to use to the list of converters
Sets up the $converters array.
Parameters:
- string $output - output format (HTML, PDF, XML). Must be all caps
- string $name - Converter name (frames, for example, is the name of HTMLframesConverter)
- string $template - template to use, should be a relative path to the templates dir (like DOM/default)
[ Top ]
addElementToPage
void addElementToPage(
parserElement
$element, string
$path)
[line 1476]
adds a processed descendant of parserElement to the $pages array or $privatepages array
This function expects the page to exist in either $pages or $privatepages. It calls the parserData::addElement() method to add $element to the page.
Parameters:
- parserElement $element - this will actually be a descendant of parserElement
- string $path -
[ Top ]
addPackageParent
void addPackageParent(
parserClass
&$class)
[line 1687]
If the parent class of $class is in a different package, adds it to the
$package_parents array
Parameters:
- parserClass &$class -
[ Top ]
addPage
void addPage(
parserPage
$page, string
$path)
[line 1370]
Replaces the parserPage represented by $this->pages[$path] with $page
Called by addPageIfNecessary(), handleDocBlock() and ProceduralPages::setupPages(), this method first checks to see if the page has been added. If not, it assumes that the page has either been @ignored or set with @access private with --parseprivate off, and returns addPrivatePage(). Otherwise, it sets the pages[$path] to be the parserPage $page and sets the package and subpackage to that of $page
Tags:
Parameters:
- parserPage $page -
- string $path - full path to the file
[ Top ]
addPageIfNecessary
void addPageIfNecessary(
string
$path,
&$class)
[line 1400]
add a new parserPage to the $pages array if none is found
This method is used when a page has been @ignored or marked with @access private, and a public class is in the page (a class with no @access private in its DocBlock). The method first creates a new page in the $pages array and then copies path information, and calls addPage() to set up packages
Parameters:
- string $path - full path of page
- &$class -
[ Top ]
addPrivatePage
void addPrivatePage(
parserPage
$page, string
$path)
[line 1438]
Adds a parserPage element to the parserData element in $this->privatepages[$path]
Performs a similar function to addPage, but adds to the $privatePages array
Tags:
Parameters:
- parserPage $page -
- string $path - full path to the page
[ Top ]
addUses
void addUses(
parserElement
$element, string
$path)
[line 1507]
Add all the @uses tags from $element to the $uses array so that @usedby
virtual tags can be added
Tags:
- uses - parserUsesTag::getSeeElement() - used to initialize $uses
- uses - parserUsesTag::getDescription() - used to initialize $uses
Parameters:
- parserElement $element - descendant of parserElement
- string $path - full path to the file
[ Top ]
ClasselementCmp
int ClasselementCmp(
mixed
$a, mixed
$b)
[line 1777]
does a natural case sort on two class elements (either parserClass, parserMethod or parserVar
Tags:
- see - generateElementIndex()
Parameters:
- mixed $a -
- mixed $b -
[ Top ]
Convert
void Convert(
$title,
$converter)
[line 1652]
Interface to the Converter
This function simply passes $pages and package_pages to the walk() method, and then calls the Output() method. Note that Output() is not required to do anything, and in fact doesn't in HTMLframesConverter.
Tags:
- uses - Converter::walk() - passes $pages and $package_pages
- uses - Converter::Output()
Parameters:
- $title -
- $converter -
[ Top ]
elementCmp
int elementCmp(
mixed
$a, mixed
$b)
[line 1763]
does a natural case sort on two parserElement descendants
Tags:
- see - generateElementIndex()
Parameters:
- mixed $a -
- mixed $b -
[ Top ]
handleClass
void handleClass(
integer
$event, parserClass
$data)
[line 905]
handles post-parsing of classes
This function sets $data->clean to false to tell the phpDocumentor_IntermediateParser that a page-level DocBlock can't be found after this point on this page. It sets $cur_class to its name, and if an @ignore tag is found in the DocBlock, it sets $private_class to true, to prevent post-parsing of any of the class's vars or methods. Then it checks for the existence of a package page for the class's package
Parameters:
- integer $event - Event number from Parser.inc
- parserClass $data -
[ Top ]
handleConst
void handleConst(
integer
$event, parserVar
$data)
[line 609]
handles post-parsing of class constants
This function aligns $data's $path var and packages to match the parent object
Parameters:
- integer $event - Event number from Parser.inc
- parserVar $data -
[ Top ]
handleDefine
void handleDefine(
integer
$event, parserDefine
$data)
[line 849]
handles post-parsing of defines
This function sets $data->clean to false to tell the phpDocumentor_IntermediateParser that a page-level DocBlock can't be found after this point on this page. It then sets the package to be the same as the page and adds itself to the ProceduralPages class
Parameters:
- integer $event - Event number from Parser.inc
- parserDefine $data -
[ Top ]
handleDocBlock
void handleDocBlock(
integer
$event, parserDocBlock
$data)
[line 1047]
handles post-parsing of DocBlocks
This function sets $last to the DocBlock represented by $data, to allow the next documentable element passed to phpDocumentor_IntermediateParser to link the DocBlock into its $docblock property. This function also checks for two special cases of DocBlocks:
- First DocBlock in the file contains a @package tag
- First DocBlock in the file is immediately followed by another DocBlock
New in version 1.2.2, if the first DocBlock in a file contains a @package tag, it is a page-level DocBlock.
If the DocBlock is page-level, it is processed with _processPageLevelDocBlock
Finally, the function replaces the old parserPage in parserData::$data->parent with the new one containing information from the DocBlock by calling addPage(), and checks for package-level docs.
Parameters:
- integer $event - Event number from Parser.inc
- parserDocBlock $data -
[ Top ]
HandleEvent
void HandleEvent(
integer
$event, mixed
$data)
[line 1227]
called via Parser::parse() and Parser's inherited method Publisher::publishEvent()
$event is one of the PHPDOC constants from Parser.inc. If it is not PHPDOCUMENTOR_EVENT_NEWSTATE, then a function name is retrieved from the $event_handlers array and called to handle the $data
Tags:
- global - array $_phpDocumentor_setting$phpDocumentor_DefaultPackageName: we use 'sourcecode' to determine whether to highlight the source of the current file if it has no file-level docblock
Parameters:
- integer $event - event number from Parser.inc
- mixed $data - if $event is PHPDOCUMENTOR_EVENT_NEWSTATE, $data is a PHP_DOC_EVENT_END_PAGE or STATE_END_CLASS, otherwise $data is either a parserDocBlock, parserPage or descendant of parserElement
[ Top ]
handleFunction
void handleFunction(
integer
$event, parserFunction
$data)
[line 763]
handles post-parsing of functions
This function sets $data->clean to false to tell the phpDocumentor_IntermediateParser that a page-level DocBlock can't be found after this point on this page. It then sets the package to be the same as the page, aligns the docblock's @param, @global, and @staticvar tags with the information parsed from the function source code.
If source code has been parsed by a {@source} tag, the source is added to its docblock, and then the parserFunction adds itself to the ProceduralPages class
Parameters:
- integer $event - Event number from Parser.inc
- parserFunction $data -
[ Top ]
handleGlobal
void handleGlobal(
integer
$event, parserGlobal
$data)
[line 459]
handles post-parsing of global variables
This function sets $data->clean to false to tell the phpDocumentor_IntermediateParser that a page-level DocBlock can't be found after this point on this page. It then sets the package to be the same as the page, and adds itself to the ProceduralPages class
Parameters:
- integer $event - Event number from Parser.inc
- parserGlobal $data -
[ Top ]
handleInclude
void handleInclude(
integer
$event, parserInclude
$data)
[line 403]
handles post-parsing of include/require/include_once/require_once
This function sets $data->clean to false to tell the phpDocumentor_IntermediateParser that a page-level DocBlock can't be found after this point on this page. It then sets the package to be the same as the page, and adds itself to the ProceduralPages class
Parameters:
- integer $event - Event number from Parser.inc
- parserInclude $data -
[ Top ]
handleMethod
void handleMethod(
integer
$event, parserMethod
$data)
[line 659]
handles post-parsing of class methods
This function first aligns $data's path and package to match the parent object, and also aligns the docblock's @param, @global, and @staticvar tags with the information parsed from the method source code. It also checks to see if the method is a constructor and sets the $isConstructor flag. If source code has been parsed by a {@source} tag, the source is added to its docblock
Finally, it adds the method to the Classes class.
Parameters:
- integer $event - Event number from Parser.inc
- parserMethod $data -
[ Top ]
handlePackagePage
void handlePackagePage(
integer
$event, parserPackagePage
$data)
[line 515]
handles post-parsing of Package-level documentation pages.
sets the $package_pages[$data->package] to $data
Parameters:
- integer $event - Event number from Parser.inc
- parserPackagePage $data -
[ Top ]
handlePage
void handlePage(
integer
$event, parserPage
$data)
[line 1001]
handles post-parsing of procedural pages
this event is called at the start of a new page, before the Parser knows whether the page will contain any procedural pages or not
Parameters:
- integer $event - Event number from Parser.inc
- parserPage $data -
[ Top ]
handleTutorial
void handleTutorial(
integer
$event, parserTutorial
$data)
[line 530]
handle post-parsing of Tutorials.
This adds the parsed tutorial to the tutorial tree
Tags:
- since - 1.2
- uses - $tutorials - sets the value of tutorials to parameter $data
Parameters:
- integer $event - Event Number
- parserTutorial $data -
[ Top ]
handleVar
void handleVar(
integer
$event, parserVar
$data)
[line 550]
handles post-parsing of class vars
This function sets up a @var tag if none is found, and aligns $data's $path var and packages to match the parent object
Parameters:
- integer $event - Event number from Parser.inc
- parserVar $data -
[ Top ]
Output
void Output(
[
$title = "Generated Documentation"])
[line 1807]
call this method once parsing has completed.
This method calls the private methods fixClasses and fixProcPages, both of which adjust inheritance and package information based on complicated post-parsing rules described in ProceduralPages::setupPages() and Classes::Inherit(). Then, it sorts elements of the $pages array and calls Convert for each Converter in the $converters array
Tags:
- see - phpDocumentor_IntermediateParser::Convert()
- see - phpDocumentor_IntermediateParser::$pages
- see - phpDocumentor_IntermediateParser::$converters
Parameters:
- $title -
[ Top ]
parsePackagePage
void parsePackagePage(
string
$package, string
$path)
[line 1181]
Backward-compatibility only, use the new tutorials for more power
Tags:
- tutorial - phpDocumentor Tutorials
Parameters:
- string $package - package name of package file to parse
- string $path - directory of file that contains package name
[ Top ]
setParsePrivate
void setParsePrivate(
bool
$parse)
[line 1931]
set display of elements marked with @access private
If set to true, elements will be displayed
Parameters:
- bool $parse -
[ Top ]
setQuietMode
void setQuietMode(
bool
$quietMode)
[line 1908]
set parsing information output mode (quiet or verbose)
If set to false, no parsing information (parsing /php/file/thisfile.php, Converting etc.) will be displayed. Useful for cron jobs
Parameters:
- bool $quietMode -
[ Top ]
setTargetDir
void setTargetDir(
string
$dir)
[line 1884]
Sets the output directory
Parameters:
- string $dir - the output directory
[ Top ]
setTemplateBase
void setTemplateBase(
string
$dir)
[line 1895]
Sets the template base directory
Tags:
- tutorial - -tb, --templatebase
Parameters:
- string $dir - the template base directory
[ Top ]
setUndocumentedElementWarningsMode
void setUndocumentedElementWarningsMode(
bool
$undocumentedElementWarnings)
[line 1920]
show warnings for undocumented elements
If set to false, no warnings will be shown for undocumented elements. Useful for identifying classes and methods that haven't yet been documented.
Parameters:
- bool $undocumentedElementWarnings -
[ Top ]
_guessPackage
void _guessPackage(
string
$path, template-ready
$sourceloc)
[line 376]
Guess the package/subpackage based on subdirectory if the --pear option
A file in pear/dir/file.php will be in package "dir." A file in pear/dir/subdir/file.php will be in package "dir," subpackage "subdir."
Tags:
- global - array $_phpDocumentor_setting: uses the 'pear' option to determine whether to guess based on subdirectory
- tutorial - -p, --pear
Parameters:
- string $path - full path of file
- template-ready $sourceloc - source location Program_Root/dir/file.php
[ Top ]