Located in File: /phpDocumentor/Converter.inc
The Converter marks the final stage in phpDocumentor. phpDocumentor works in this order:
Parsing => Intermediate Parsing organization => Conversion to output
A Converter takes output from the phpDocumentor_IntermediateParser and converts it to output. With version 1.2, phpDocumentor includes a variety of output converters:
The class itself has a link under ###main
array(package => array(subpackage => array(path => array(class => array(abstractLink descendant 1, ... ) ) ) )
Generation of these indexes for large packages is time-consuming. This is an optimization feature. An example of how to use this is in HTMLframesConverter::$leftindex, and in HTMLframesConverter::formatLeftIndex(). These indexes are intended for use as navigational aids through documentation, but can be used for anything by converters.
in Child converters, this will match the first part of the -o command-line as in -o HTML:frames:default "HTML"
Used by the XML:DocBook/peardoc2 converter, and available to others, to group many packages into categories
Every package that contains classes may have parent or child classes in other packages. In other words, this code is legal:
In this case, package one is a parent of package two
The page itself has a link under ###main
defaults to false. Set with command-line --parseprivate or -pp
In order to fix PEAR Bug #6389
defaults to false. Set to true for cron jobs or other situations where no visual output is necessary
This fixes bug 637921, and is used by PDFdefaultConverter
to a string based on the template options.ini
Overridden in child classes as:
This will call ConvertXxx where Xxx is http://www.php.net/ucfirst($element->type). It is expected that a child converter defines a handler for every element type, even if that handler does nothing. phpDocumentor will terminate with an error if a handler doesn't exist.
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. Sets up the class template. {@, getFormattedConflicts, getFormattedInheritedMethods, and getFormattedInheritedVars are called to complete vital template setup.}}
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template.
This function must be called by a child converter with any extra template variables needed in the parameter $addition
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. This function must be called by a child converter with any extra template variables needed in the parameter $addition {@, this method also uses utility functions getGlobalValue(), getFormattedConflicts()}}
Overridden in child classes as:
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. This function must be called by a child converter with any extra template variables needed in the parameter $addition
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. This function must be called by a child converter with any extra template variables needed in the parameter $addition {@, this method also uses utility functions getGlobalValue(), getFormattedConflicts()}}
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. This function must be called by a child converter with any extra template variables needed in the parameter $addition
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. This function must be called by a child converter with any extra template variables needed in the parameter $addition
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. {@, this class uses getSourceLocation() and getClassesOnPage() to set template variables. Also used is getPageName(), to get a Converter-specific name for the page.}}
to a string based on the template options.ini
Overridden in child classes as:
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template. Sets up the tutorial template, and its prev/next/parent links {@ and uses the parserTutorial::prev, parserTutorial::next, parserTutorial::parent links to set up those links.}}
Overridden in child classes as:
Conversion Handlers
All of the convert* handlers set up template variables for the Smarty template.
This function must be called by a child converter with any extra template variables needed in the parameter $addition
Overridden in child classes as:
thanks to Robert Hoffmann for this fix
Overridden in child classes as:
A Converter can use this method in any way it pleases. HTMLframesConverter uses it to complete the template for the class and to output its documentation
Overridden in child classes as:
A Converter can use this method in any way it pleases. HTMLframesConverter uses it to complete the template for the procedural page and to output its documentation
Overridden in child classes as:
By default, this just wraps ProgramExample
Overridden in child classes as:
This method is intended to be the place that $elements is formatted for output.
Overridden in child classes as:
This method is intended to be the place that any of $class_elements, $function_elements, $page_elements, $define_elements, and $global_elements is formatted for output, depending on the value of $leftindex
Overridden in child classes as:
This method is intended to be the place that $pkg_elements is formatted for output.
Overridden in child classes as:
This function should return a formatted table of contents. By default, it does nothing, it is up to the converter to format the TOC
Overridden in child classes as:
Overridden in child classes as:
This method must be overridden, or phpDocumentor will halt with a fatal error
$element, a parserData class
links to each classes documentation
Format:
array('name' => class name, 'sdesc' => summary of the class 'link' => link to the class's documentation)
Overridden in child classes as:
Overridden in child classes as:
Overridden in child classes as:
Overridden in child classes as:
Overridden in child classes as:
This method must be overridden, or phpDocumentor will halt with a fatal error
uses parserConst helper function getInheritedConsts and generates a template-enabled list using getClassLink()
array( array('parent_class' => link to parent class's documentation, 'ivars' => array( array('name' => inherited constant name, 'link' => link to inherited constant's documentation, 'value' => constant value, 'sdesc' => summary of inherited constant), ...), ...)
uses parserMethod helper function getInheritedMethods and generates a template-enabled list using getClassLink()
array( array('parent_class' => link to parent class's documentation, 'ivars' => array( array('name' => inherited variable name, 'link' => link to inherited variable's documentation, 'function_call' => parserMethod::getIntricateFunctionCall() returned array, 'sdesc' => summary of inherited variable), ...), ...)
uses parserVar helper function getInheritedVars and generates a template-enabled list using getClassLink()
array( array('parent_class' => link to parent class's documentation, 'ivars' => array( array('name' => inherited variable name, 'link' => link to inherited variable's documentation, 'default' => default value of inherited variable, 'sdesc' => summary of inherited variable), ...), ...)
Overridden in child classes as:
Overridden in child classes as:
Overridden in child classes as:
If a global variable's default value is "new class" as in:
Overridden in child classes as:
unique ID in the format needed for the Converter
Although not very smart yet, this method will try to look for the included file file.ext:
If it finds it, it will return a link to the file's documentation. As of 1.2.0rc1, phpDocumentor is smarty enough to find these cases:
Overridden in child classes as:
$expr is a string with many allowable formats:
New in version 1.1, you can explicitly specify a package to link to that is different from the current package. Use the # operator to specify a new package, as in tests#bug-540368.php (which should appear as a link like: "bug-540368.php"). This example links to the procedural page bug-540368.php in package tests. Also, the "function" operator is now used to specifically link to a function instead of a method in the current class.
If classname:: is not present, and the see tag is in a documentation block within a class, then the function uses the classname to search for $expr as a function or variable within classname, or any of its parent classes. given an $expr without '$', '::' or '()' getLink first searches for classes, procedural pages, constants, global variables, and then searches for methods and variables within the default class, and finally for any function
Overridden in child classes as:
Overridden in child classes as:
The data structure returned is designed for a non-recursive algorithm, and is somewhat complex. In most cases, the array returned is:
array('#root' => array('link' => classLink to $class, 'parent' => false, 'children' => array(array('class' => 'childclass1', 'package' => 'child1package'), array('class' => 'childclass2', 'package' => 'child2package'),... ) ), 'child1package#childclass1' => array('link' => classLink to childclass1, 'parent' => '#root', 'children' => array(array('class' => 'kidclass', 'package' => 'kidpackage'),... ) ), 'kidpackage#kidclass' => array('link' => classLink to kidclass, 'parent' => 'child1package#childclass1', 'children' => array() // no children ), .... )
To describe this format using language, every class in the tree has an entry in the first level of the array. The index for all child classes that extend the root class is childpackage#childclassname. Each entry in the array has 3 elements: link, parent, and children.
special cases are when the #root class has a parent in another package, or when the #root class extends a class not found by phpDocumentor. In the first case, parent will be a classLink to the parent class. In the second, parent will be the extends clause, as in:
The fastest way to design a method to process the array returned is to copy HTMLframesConverter::getRootTree() into your converter and to modify the html to whatever output format you are going to use
Overridden in child classes as:
Overridden in child classes as:
Overridden in child classes as:
Used by {@id}
Take a string and return an abstract link to the tutorial it represents. Since tutorial naming literally works like the underlying filesystem, the way to reference the tutorial is similar. Tutorials are located in a subdirectory of any directory parsed, which is named 'tutorials/' (we try to make things simple when we can :). They are further organized by package and subpackage as:
tutorials/package/subpackage
and the files are named *.cls, *.pkg, or *.proc, and so a link to a tutorial named file.cls can be referenced (depending on context) as any of:
The first case will only be needed if file.cls exists in both the current package, in anotherpackage/file.cls and in anotherpackage/subpackage/file.cls and you wish to reference the one in anotherpackage/subpackage. The second case is only needed if you wish to reference file.cls in another package and it is unique in that package. the third will link to the first file.cls it finds using this search method:
Overridden in child classes as:
Returns an array in format:
array('tutorial' => parserTutorial, 'kids' => array( // child tutorials array('tutorial' => child parserTutorial, 'kids' => array(...) ) ) )
Overridden in child classes as:
Wrapper for $sourcePaths in this version
default returns it unchanged. Mainly used by the HighlightParser
default returns it unchanged. Mainly used by the HighlightParser
default returns it unchanged. Mainly used by the HighlightParser
This returns a Smarty template with pre-initialized variables for use. If the method "SmartyInit()" exists, it is called.
Overridden in child classes as:
Overridden in child classes as:
Perform necessary post-processing of string data. For example, the HTML Converters should escape < and > to become < and >
Overridden in child classes as:
This function converts all tags and descriptions for output
array('sdesc' => DocBlock summary 'desc' => DocBlock detailed description 'tags' => array('keyword' => tagname, 'data' => tag description) known tags 'api_tags' => array('keyword' => tagname, 'data' => tag description) known api documentation tags 'info_tags' => array('keyword' => tagname, 'data' => tag description) known informational tags [ 'utags' => array('keyword' => tagname, 'data' => tag description unknown tags ] [ 'vartype' => type from @var/@return tag ] [ 'var_descrip' => description from @var/@return tag ] )
Overridden in child classes as:
Overridden in child classes as:
Overridden in child classes as:
in the format needed for the Converter
Overridden in child classes as:
As of 1.3.0RC6, this also sets the compiled templates directory inside the target directory
Overridden in child classes as:
Also sets $templateName to the $dir parameter
Overridden in child classes as:
If the $path is a full path, then an anchor to the line number will be added as well
Overridden in child classes as:
Overridden in child classes as:
Overridden in child classes as:
Used by XMLDocBookConverter::type_adjust() to change true and false to the peardoc2 values
Overridden in child classes as:
default returns it unchanged (html with xhtml tags)
The walk() method should be flexible enough such that it never needs modification. walk() sets up all of the indexes, and sorts everything in logical alphabetical order. It then passes each element individually to Convert(), which then passes to the Convert*() methods. A child Converter need not override any of these unless special functionality must be added. see Converter Default Template Variables for details. {@ and the left indexes specified by $leftindexes, and then sorts them by calling sortIndexes().
Next, it converts all README/CHANGELOG/INSTALL-style files, using Convert_RIC.
After this, it passes all package-level docs to Convert(). Then, it calls the index sorting functions formatPkgIndex(), formatIndex() and formatLeftIndex().
Finally, it converts each procedural page in alphabetical order. This stage passes elements from the physical file to Convert() in alphabetical order. First, procedural page elements parserDefine, parserInclude parserGlobal, and parserFunction are passed to Convert().
Then, class elements are passed in this order: parserClass, then all of the parserVars in the class and all of the parserMethods in the class. Classes are in alphabetical order, and both vars and methods are in alphabetical order.
Finally, ConvertErrorLog() is called and the data walk is complete.}}
This method is designed for converters like the PDF converter that need everything passed in alphabetical order by package/subpackage and by procedural and then class information
Overridden in child classes as:
This function provides the primary functionality for the @example tag.
Overridden in child classes as:
Overridden in child classes as:
This function provides the primary functionality for the @filesource tag.