| 1 |
lars |
1 |
<?php
|
|
|
2 |
/** @package tests */
|
|
|
3 |
|
|
|
4 |
/**
|
|
|
5 |
* Base class for all output converters.
|
|
|
6 |
* A Converter takes output from the {@link Parser} and converts it to template-friendly output. A converter for the standard phpDocumentor
|
|
|
7 |
* template, {@link HTMLConverter}, is provided with this release. Future releases will have support for other formats and templates, including
|
|
|
8 |
* DocBook, XML, and possibly other HTML templates. The converter takes output directly from {@link NewRender} and using {@link walk()} it
|
|
|
9 |
* "walks" over an array of phpDocumentor elements, as represented by descendants of {@link parserElement}
|
|
|
10 |
*
|
|
|
11 |
* a converter must define the abstract function Convert (an example is {@link HTMLConverter::Convert()}), a function that takes a passed object
|
|
|
12 |
* and uses it to generate structures for an output template, or directly generates output. Since all elements have their DocBlocks linked
|
|
|
13 |
* directly, this allows for more logical parsing than earlier versions of phpDocumentor.
|
|
|
14 |
*
|
|
|
15 |
* A Converter is passed several data structures in its constructor, all of which are optional in output and may be handled in any way
|
|
|
16 |
* the converter would like. These structures are arrays:
|
|
|
17 |
* <ul>
|
|
|
18 |
* <li>array of methods by class (see {@link NewRender::$methods})</li>
|
|
|
19 |
* <li>array of variables by class (see {@link NewRender::$vars})</li>
|
|
|
20 |
* <li>array of links to documented elements (see {@link NewRender::$links})</li>
|
|
|
21 |
* <li>array of class parents by name (see {@link NewRender::$classtree})</li>
|
|
|
22 |
* <li>array of class packages by classname (see {@link NewRender::$classpackages})</li>
|
|
|
23 |
* <li>array of packages to document (see {@link NewRender::$packageoutput})</li>
|
|
|
24 |
* <li>array of extended classes by parent classname (see {@link NewRender::$class_children})</li>
|
|
|
25 |
* <li>array of all documented elements by name (see {@link NewRender::$elements})</li>
|
|
|
26 |
* <li>array of all documented elements by name, split by package (see {@link NewRender::$pkg_elements})</li>
|
|
|
27 |
* <li>boolean option, set to true to parse all elements marked @access private (see {@link NewRender::$parsePrivate})</li>
|
|
|
28 |
* <li>boolean option, set to true to stop informative output while parsing (good for cron jobs) (see {@link NewRender::$quietMode})</li>
|
|
|
29 |
* </ul>
|
|
|
30 |
* @package tests
|
|
|
31 |
* @abstract
|
|
|
32 |
* @see parserDocBlock, parserInclude, parserPage, parserClass, parserDefine, parserFunction, parserMethod, parserVar
|
|
|
33 |
*/
|
|
|
34 |
class iConverter
|
|
|
35 |
{
|
|
|
36 |
|
|
|
37 |
function walk()
|
|
|
38 |
{
|
|
|
39 |
}
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* @package tests
|
|
|
44 |
*/
|
|
|
45 |
class iParser
|
|
|
46 |
{
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
class iHTMLConverter extends iConverter
|
|
|
50 |
{
|
|
|
51 |
function Convert()
|
|
|
52 |
{
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
/**
|
|
|
57 |
* @package tests
|
|
|
58 |
*/
|
|
|
59 |
class iparserElement
|
|
|
60 |
{
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* @package tests
|
|
|
65 |
*/
|
|
|
66 |
class iNewRender
|
|
|
67 |
{
|
|
|
68 |
/**
|
|
|
69 |
* array of methods by package, subpackage and class
|
|
|
70 |
* format:
|
|
|
71 |
* array(packagename =>
|
|
|
72 |
* array(subpackagename =>
|
|
|
73 |
* array(classname =>
|
|
|
74 |
* array(methodname1 => {@link parserMethod} class,
|
|
|
75 |
* methodname2 => {@link parserMethod} class,...)
|
|
|
76 |
* )
|
|
|
77 |
* )
|
|
|
78 |
* )
|
|
|
79 |
* )
|
|
|
80 |
* @var array
|
|
|
81 |
* @see Converter
|
|
|
82 |
*/
|
|
|
83 |
var $methods = array();
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
* array of class variables by package, subpackage and class
|
|
|
87 |
* format:
|
|
|
88 |
* array(packagename =>
|
|
|
89 |
* array(subpackagename =>
|
|
|
90 |
* array(classname =>
|
|
|
91 |
* array(variablename1 => {@link parserMethod} class,
|
|
|
92 |
* variablename2 => {@link parserMethod} class,...)
|
|
|
93 |
* )
|
|
|
94 |
* )
|
|
|
95 |
* )
|
|
|
96 |
* )
|
|
|
97 |
* @var array
|
|
|
98 |
* @see Converter
|
|
|
99 |
*/
|
|
|
100 |
var $vars = array();
|
|
|
101 |
|
|
|
102 |
/**
|
|
|
103 |
* set in {@link phpdoc.inc} to the value of the parserprivate commandline option.
|
|
|
104 |
* If this option is true, elements with an @access private tag will be parsed and displayed
|
|
|
105 |
* @var bool
|
|
|
106 |
*/
|
|
|
107 |
var $parsePrivate = false;
|
|
|
108 |
|
|
|
109 |
/**
|
|
|
110 |
* this variable is used to prevent parsing of private elements if $parsePrivate is false.
|
|
|
111 |
* it is also used by the packageoutput setting to prevent parsing of elements that aren't in the
|
|
|
112 |
* desired output packages
|
|
|
113 |
* @see $packageoutput
|
|
|
114 |
* @see $parsePrivate
|
|
|
115 |
*/
|
|
|
116 |
var $private_class = false;
|
|
|
117 |
|
|
|
118 |
/**
|
|
|
119 |
* the workhorse of linking.
|
|
|
120 |
* This array is an array of link objects of format:
|
|
|
121 |
* [package][subpackage][eltype][elname] = descendant of {@link abstractLink}
|
|
|
122 |
* eltype can be page|include|function|define|class|method|var
|
|
|
123 |
* if eltype is method or var, the array format is:
|
|
|
124 |
* [package][subpackage][eltype][class][elname]
|
|
|
125 |
* @var array
|
|
|
126 |
* @see functionLink, pageLink, classLink, defineLink, methodLink, varLink
|
|
|
127 |
*/
|
|
|
128 |
var $links = array();
|
|
|
129 |
|
|
|
130 |
/**
|
|
|
131 |
* a tree of class inheritance by name.
|
|
|
132 |
* format:
|
|
|
133 |
* array(childname => parentname,
|
|
|
134 |
* childname1 => parentname1,
|
|
|
135 |
* rootname => 0, ...
|
|
|
136 |
* )
|
|
|
137 |
* @var array
|
|
|
138 |
* @see Converter::generateClassTreeFromClass()
|
|
|
139 |
*/
|
|
|
140 |
var $classtree = array();
|
|
|
141 |
|
|
|
142 |
/**
|
|
|
143 |
* used in {@link Converter::getClassPackage()} to inherit package from parent classes.
|
|
|
144 |
* format:
|
|
|
145 |
* array(classname => array(array(package,subpackage),
|
|
|
146 |
* array(package1,subpackage1),....
|
|
|
147 |
)
|
|
|
148 |
)
|
|
|
149 |
* If a name conflict exists between two packages, automatic inheritance will not work, and the packages will need
|
|
|
150 |
* to be documented separately.
|
|
|
151 |
* @var array
|
|
|
152 |
*/
|
|
|
153 |
var $classpackages = array();
|
|
|
154 |
|
|
|
155 |
/**
|
|
|
156 |
* used to set the output directory
|
|
|
157 |
* @see setTargetDir()
|
|
|
158 |
*/
|
|
|
159 |
var $targetDir;
|
|
|
160 |
|
|
|
161 |
/**
|
|
|
162 |
* array of class inheritance indexed by parent class and package
|
|
|
163 |
*
|
|
|
164 |
* Format:
|
|
|
165 |
* array(Packagename => array(ParentClassname1 => array(Child1name,Child2name),
|
|
|
166 |
* ParentClassname2 => array(Child1name,Child2name),...
|
|
|
167 |
* )
|
|
|
168 |
* )
|
|
|
169 |
* @see Converter::getRootTree()
|
|
|
170 |
* @var array
|
|
|
171 |
*/
|
|
|
172 |
|
|
|
173 |
/**
|
|
|
174 |
* An array of extended classes by package and parent class
|
|
|
175 |
* Format:
|
|
|
176 |
* array(packagename => array(parentclass => array(childclassname1,
|
|
|
177 |
* childclassname2,...
|
|
|
178 |
* )
|
|
|
179 |
* )
|
|
|
180 |
* )
|
|
|
181 |
* @var array
|
|
|
182 |
*/
|
|
|
183 |
var $class_children = array();
|
|
|
184 |
|
|
|
185 |
var $elements = array();
|
|
|
186 |
|
|
|
187 |
var $pkg_elements = array();
|
|
|
188 |
|
|
|
189 |
var $pages = array();
|
|
|
190 |
|
|
|
191 |
/**
|
|
|
192 |
* array of packages to parser and output documentation for, if not all packages should be documented
|
|
|
193 |
* Format:
|
|
|
194 |
* array(package1,package2,...)
|
|
|
195 |
* or false if not set
|
|
|
196 |
* 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
|
|
|
197 |
* but don't want included in output, set a package name for all the elements in your project, and set packageoutput to that name.
|
|
|
198 |
* the default package will be ignored. Parsing speed does not improve. If you want to ignore files for speed reasons, use the ignore
|
|
|
199 |
* command-line option
|
|
|
200 |
* @see Io
|
|
|
201 |
* @var mixed
|
|
|
202 |
*/
|
|
|
203 |
var $packageoutput = false;
|
|
|
204 |
|
|
|
205 |
/**
|
|
|
206 |
* the functions which handle output from the {@link Parser}
|
|
|
207 |
* @see handleEvent(), handleDocBlock(), handlePage(), handleClass(), handleDefine(), handleFunction(), handleMethod(), handleVar(),
|
|
|
208 |
* handlePackagePage(), handleInclude()
|
|
|
209 |
*/
|
|
|
210 |
var $event_handlers = array(
|
|
|
211 |
'docblock' => 'handleDocBlock',
|
|
|
212 |
'page' => 'handlePage',
|
|
|
213 |
'class' => 'handleClass',
|
|
|
214 |
'define' => 'handleDefine',
|
|
|
215 |
'function' => 'handleFunction',
|
|
|
216 |
'method' => 'handleMethod',
|
|
|
217 |
'var' => 'handleVar',
|
|
|
218 |
'packagepage' => 'handlePackagePage',
|
|
|
219 |
'include' => 'handleInclude',
|
|
|
220 |
);
|
|
|
221 |
|
|
|
222 |
/**
|
|
|
223 |
* data contains parsed structures for the current page being parsed
|
|
|
224 |
* @var parserData
|
|
|
225 |
* @see parserData
|
|
|
226 |
*/
|
|
|
227 |
var $data;
|
|
|
228 |
|
|
|
229 |
/**
|
|
|
230 |
* set to the name of the package of the current class being parsed
|
|
|
231 |
* @var string
|
|
|
232 |
*/
|
|
|
233 |
var $classpackage = 'default';
|
|
|
234 |
|
|
|
235 |
/**
|
|
|
236 |
* set to the name of the subpackage of the current class being parsed
|
|
|
237 |
* @var string
|
|
|
238 |
*/
|
|
|
239 |
var $classsubpackage = '';
|
|
|
240 |
|
|
|
241 |
/**
|
|
|
242 |
* set in {@link phpdoc.inc} to the value of the quitemode commandline option.
|
|
|
243 |
* If this option is true, informative output while parsing will not be displayed (documentation is unaffected)
|
|
|
244 |
* @var bool
|
|
|
245 |
*/
|
|
|
246 |
var $quietMode = false;
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
}
|
|
|
250 |
?>
|