Class: Converter
Source Location: /PhpDocumentor-1.2.0beta2/phpDocumentor/Converter.inc
Base class for all output converters.
Author(s):
Version:
- $Id: Converter.inc,v 1.138 2003/01/18 07:25:19 CelloG Exp $
|
|
|
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
$all_packages =
[line 217]
$class = false
[line 54]
set to a classname if currently parsing a class, false if not
$classes =
[line 205]
$class_contents = array()
[line 164]
alphabetical index of all methods and vars in a class by package/subpackage The class itself has a link under ###main
$class_elements = array()
[line 116]
alphabetized index of classes by package
$curfile =
[line 200]
name of the current file being converted
$define_elements = array()
[line 110]
alphabetized index of defines by package
$elements = array()
[line 98]
alphabetical index of all elements
$function_elements = array()
[line 128]
alphabetized index of functions by package
$global_elements = array()
[line 122]
alphabetized index of global variables by package
$leftindex = array('classes' => true, 'pages' => true, 'functions' => true, 'defines' => true, 'globals' => true)
[line 229]
Controls which of the one-element-only indexes are generated. 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.
$outputformat = 'Generic'
[line 39]
output format of this converter
$package = 'default'
[line 44]
package name
$package_elements = array()
[line 92]
alphabetical index of all elements sorted by package, subpackage, page, and class. Used by
$package_output =
[line 86]
set to value of -po commandline
$package_parents =
[line 211]
$page_contents = array()
[line 143]
alphabetical index of all elements on a page by package/subpackage The page itself has a link under ###main
$page_elements = array()
[line 104]
alphabetized index of procedural pages by package
$parseprivate =
[line 171]
controls processing of elements marked private with @access private defaults to false. Set with command-line --parseprivate or -pp
$pkg_elements = array()
[line 134]
alphabetical index of all elements
$quietmode =
[line 178]
controls display of progress information while parsing. defaults to false. Set to true for cron jobs or other situations where no visual output is necessary
$sort_absolutely_everything = false
[line 156]
This is used if the content must be passed in the order it should be read, i.e. by package, procedural then classes This fixes bug 637921, and is used by PDFdefaultConverter
$sort_page_contents_by_type = false
[line 150]
This determines whether the $page_contents array should be sorted by element type as well as alphabetically by name
$subpackage = ''
[line 49]
subpackage name
$targetDir = ''
[line 183]
directory that output is sent to. -t command-line sets this.
$templateDir = ''
[line 189]
Directory that the template is in, relative to phpDocumentor root directory
$templateName = ''
[line 195]
Name of the template
$template_options =
[line 250]
Options for each template, parsed from the options.ini file in the template base directory
$title = 'Generated Documentation'
[line 237]
Method Detail
Converter (Constructor) [line 279]
Converter Converter(
array
&$allp, array
&$packp, Classes
&$classes, ProceduralPages
&$procpages, array
$po, boolean
$pp, boolean
$qm, string
$targetDir, string
$template, string
$title)
|
|
Initialize Converter data structures
Parameters:
AttrToString [line 712]
string AttrToString(
string
$tag, attribute
$attr, [boolean
$unmodified = false])
|
|
Convert the attribute of a Tutorial docbook tag's attribute list to a string based on the template options.ini
Parameters:
Bolden [line 496]
string Bolden(
string
$para)
|
|
Used to convert the contents of <b> in a docblock
Parameters:
Br [line 524]
Used to convert <br> in a docblock
Parameters:
checkState [line 3389]
Convert [line 3185]
ConvertErrorLog [line 1849]
ConvertTitle [line 801]
string ConvertTitle(
string
$tag, array
$attr, string
$title, string
$cdata)
|
|
Convert the title of a Tutorial docbook tag section to a string based on the template options.ini
Parameters:
Convert_RIC [line 3176]
copyFile [line 3364]
void copyFile(
string
$file, [mixed
$subdir = ''])
|
|
Copies a file from the template directory to the target directory thanks to Robert Hoffmann for this fix
Parameters:
createParentDir [line 3282]
void createParentDir(
string
$dir)
|
|
Recursively creates all subdirectories that don't exist in the $dir path
Parameters:
EncloseList [line 453]
string EncloseList(
string
$list, mixed
$ordered)
|
|
Used to convert the contents of <ol> or <ul> in a docblock
Parameters:
EncloseParagraph [line 482]
string EncloseParagraph(
string
$para)
|
|
Used to enclose a paragraph in a docblock
Parameters:
endClass [line 332]
Called by walk() while converting, when the last class element has been parsed. A Converter can use this method in any way it pleases. HTMLdefaultConverter uses it to complete the template for the class and to output its documentation
Overridden in child classes as:
- CHMdefaultConverter::endClass()
- Writes out the template file of $class_data and unsets the template to save memory
- HTMLdefaultConverter::endClass()
- Writes out the template file of $class_data and unsets the template to save memory
- HTMLframesConverter::endClass()
- Writes out the template file of $class_data and unsets the template to save memory
- HTMLSmartyConverter::endClass()
- Writes out the template file of $class_data and unsets the template to save memory
- XMLDocBookConverter::endClass()
- Writes out the template file of $class_data and unsets the template to save memory
endPage [line 344]
Called by walk() while converting, when the last procedural page element has been parsed. A Converter can use this method in any way it pleases. HTMLdefaultConverter uses it to complete the template for the procedural page and to output its documentation
Overridden in child classes as:
- CHMdefaultConverter::endPage()
- Writes out the template file of $page_data and unsets the template to save memory
- HTMLdefaultConverter::endPage()
- Writes out the template file of $page_data and unsets the template to save memory
- HTMLframesConverter::endPage()
- Writes out the template file of $page_data and unsets the template to save memory
- HTMLSmartyConverter::endPage()
- Writes out the template file of $page_data and unsets the template to save memory
- XMLDocBookConverter::endPage()
- Writes out the template file of $page_data and unsets the template to save memory
formatIndex [line 366]
formatLeftIndex [line 379]
formatPkgIndex [line 355]
formatTutorialTOC [line 553]
string formatTutorialTOC(
array
$toc)
|
|
Creates a table of contents for a {@toc} inline tag in a tutorial 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:
- HTMLframesConverter::formatTutorialTOC()
- Use the template tutorial_toc.tpl to generate a table of contents for HTML
- HTMLSmartyConverter::formatTutorialTOC()
- Use the template tutorial_toc.tpl to generate a table of contents for HTML
Parameters:
getClassLink [line 2494]
getConverterDir [line 3220]
string getConverterDir(
)
|
|
Get the absolute path to the converter's base directory
getDefineLink [line 2550]
getFunctionLink [line 2522]
getGlobalLink [line 2578]
getGlobalValue [line 3237]
string getGlobalValue(
string
$value)
|
|
Parse a global variable's default value for class initialization. If a global variable's default value is "new class" as in: 1 $globalvar = new Parser
This method will document it not as "new Parser" but instead as "new Parser". For examples, see phpdoc.inc. Many global variables are classes, and phpDocumentor links to their documentation
Parameters:
getIncludeValue [line 3264]
string getIncludeValue(
string
$value)
|
|
Parse an include's file to see if it is a file documented in this project Although not very smart yet, this method will try to look for the included file file.ext: 1 include ("file.ext");
If it finds it, it will return a link to the file's documentation. For examples, see phpdoc.inc includes. Every include auto-links to the documentation for the file that is included
Parameters:
getLink [line 2880]
mixed &getLink(
string
$expr, [string
$package = false], [array
$packages = false])
|
|
The meat of the @see tag and inline {@link} tag $expr is a string with many allowable formats: - proceduralpagename.ext
- constant_name
- classname::function()
- classname::$variablename
- classname
- function functionname()
- packagename#expr where expr is any of the above
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: "tests#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. 1 class myclass 2 { 3 // from inside the class definition, use "function conflict()" to refer to procedural function "conflict()" 4 function conflict() 5 { 6 } 7 } 8 9 function conflict() 10 { 11 }
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:
- XMLDocBookConverter::getLink()
- do that stuff in $template_options
Parameters:
getMethodLink [line 2635]
getPageLink [line 2606]
getPPageId [line 819]
getSortedClassTreeFromClass [line 2269]
array getSortedClassTreeFromClass(
string
$class, string
$package, string
$subpackage)
|
|
Return a tree of all classes that extend this class 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' => to $class,
'parent' => false,
'children' => array(array('class' => 'childclass1', 'package' => 'child1package'),
array('class' => 'childclass2', 'package' => 'child2package'),...
)
),
'child1package#childclass1' => array('link' => to childclass1,
'parent' => '#root',
'children' => array(array('class' => 'kidclass', 'package' => 'kidpackage'),...
)
),
'kidpackage#kidclass' => array('link' => 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. - link - a classLink to the current class
- parent - a classLink to the class's parent, or false (except for one special case described below)
- children - an array of arrays, each entry has a 'class' and 'package' index to the child class,
used to find the entry in the big array
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: 1 class X extends Y 2 { 3 ... 4 }
in this case, the #root entry will be array('link' => classLink to X, 'parent' => 'Y', children => array(...)) The fastest way to design a method to process the array returne is to copy HTMLframesConverter::getRootTree() into your converter and to modify the html to whatever output format you are going to use
Parameters:
getSourceLink [line 608]
getState [line 3378]
getTutorialLink [line 2733]
tutorialLink|string getTutorialLink(
string
$expr, [string
$package = false], [string
$subpackage = false], [array
$packages = false])
|
|
The meat of the @tutorial tag and inline { @tutorial} tag 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: 1 * @tutorial package/subpackage/file.cls 2 * @tutorial package/file.cls 3 * @tutorial file.cls
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: - current package/subpackage
- all other subpackages of current package
- parent package, if this package has classes that extend classes in
another package
- all other packages
Parameters:
getTutorialTree [line 1345]
getVarLink [line 2666]
hasTutorial [line 317]
false|parserTutorial hasTutorial(
pkg|cls|proc
$type, tutorial
$name, string
$package, [string
$subpackage = ''])
|
|
Parameters:
highlightSource [line 403]
Italicize [line 510]
string Italicize(
string
$para)
|
|
Used to convert the contents of <i> in a docblock
Parameters:
ListItem [line 439]
string ListItem(
string
$item)
|
|
Used to convert the contents of <li> in a docblock
Parameters:
Output [line 3194]
postProcess [line 539]
PreserveWhiteSpace [line 468]
string PreserveWhiteSpace(
string
$string)
|
|
Used to convert the contents of <pre> in a docblock
Parameters:
ProgramExample [line 425]
returnLink [line 3155]
returnSee [line 3166]
setTargetDir [line 3307]
void setTargetDir(
string
$dir)
|
|
Sets the output directory for generated documentation
Overridden in child classes as:
- CHMdefaultConverter::setTargetDir()
- calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
- HTMLdefaultConverter::setTargetDir()
- calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
- HTMLframesConverter::setTargetDir()
- calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
- HTMLSmartyConverter::setTargetDir()
- calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
- XMLDocBookConverter::setTargetDir()
- calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
Parameters:
setTemplateDir [line 3204]
sortPageContentsByElementType [line 1941]
void sortPageContentsByElementType(
mixed
&$pages)
|
|
sorts $page_contents by element type as well as alphabetically
sourceLine [line 618]
string sourceLine(
integer
$linenumber, string
$line)
|
|
Parameters:
TranslateTag [line 632]
string TranslateTag(
string
$name, string
$attr, string
$cdata)
|
|
Used to translate an xml DocBook tag from a tutorial by reading the options.ini file for the template.
Parameters:
type_adjust [line 415]
unmangle [line 391]
vardump_tree [line 1491]
void vardump_tree(
mixed
$tree, [mixed
$indent = ''])
|
|
Debugging function for dumping $tutorial_tree
walk [line 1094]
void walk(
array
&$pages, array
&$package_pages)
|
|
called by phpDocumentor_IntermediateParser::Convert() to traverse the array of pages and their elements, converting them to the output format 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(), a method that must be overridden in a child Converter. walk() first creates all of the indexes $elements, $pkg_elements and the left indexes specified by $leftindexes, and then sorts them by calling sortIndexes(). 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.
Parameters:
walk_everything [line 1706]
walk over elements by package rather than page
writeExample [line 598]
writeFile [line 3341]
void writeFile(
string
$file, string
$data, [boolean
$binary = false])
|
|
Writes a file to target dir
Parameters:
writeSource [line 567]
writeSourceFunction [line 583]
void writeSourceFunction(
string
$function, string
$path, string
$source)
|
|
Write out the formatted source code for a function This function provides the primary functionality for the tags.source.pkg tag.
Parameters:
Documentation generated on Fri, 30 Apr 2004 22:09:25 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.
|
|