home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Errors.inc < prev    next >
Encoding:
Text File  |  2004-03-24  |  29.3 KB  |  784 lines

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | phpDocumentor                                                          |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2000-2003 Joshua Eichorn, Gregory Beaver                 |
  7. // | Email         jeichorn@phpdoc.org, cellog@phpdoc.org                   |
  8. // | Web           http://www.phpdoc.org                                    |
  9. // | Mirror        http://phpdocu.sourceforge.net/                          |
  10. // | PEAR          http://pear.php.net/package-info.php?pacid=137           |
  11. // +------------------------------------------------------------------------+
  12. // | This source file is subject to version 3.00 of the PHP License,        |
  13. // | that is available at http://www.php.net/license/3_0.txt.               |
  14. // | If you did not receive a copy of the PHP license and are unable to     |
  15. // | obtain it through the world-wide-web, please send a note to            |
  16. // | license@php.net so we can mail you a copy immediately.                 |
  17. // +------------------------------------------------------------------------+
  18. //
  19.  
  20. /**
  21.  * @package phpDocumentor
  22.  * @subpackage Errors
  23.  * @author Gregory Beaver <cellog@users.sourceforge.net>
  24.  * @version $Id: Errors.inc,v 1.70.2.7 2003/07/30 00:39:39 CelloG Exp $
  25.  */
  26. /**
  27.  * warning triggered when inheritance could be from more than one class
  28.  */
  29. define("PDERROR_MULTIPLE_PARENT",1);
  30. /**
  31.  * warning triggered when parent class doesn't exist
  32.  */
  33. define("PDERROR_PARENT_NOT_FOUND",2);
  34. /**
  35.  * warning triggered when an {@inline tag} is not terminated (no } before the * / ending the comment)
  36.  */
  37. define("PDERROR_UNTERMINATED_INLINE_TAG",3);
  38. /**
  39.  * warning triggered when inheritance could be from more than one class
  40.  */
  41. define("PDERROR_CLASS_EXISTS",4);
  42. /**
  43.  * warning triggered when inheritance could be from more than one class
  44.  */
  45. define("PDERROR_INHERITANCE_CONFLICT",5);
  46. /**
  47.  * warning triggered when a converter is passed to {@link phpDocumentor_IntermediateParser::addConverter()} that is not a class
  48.  */
  49. define("PDERROR_CONVERTER_NOT_FOUND",6);
  50. /**
  51.  * warning triggered when a converter is passed to {@link phpDocumentor_IntermediateParser::addConverter()} that is not a class
  52.  */
  53. define("PDERROR_NO_CONVERTERS",7);
  54. /**
  55.  * warning triggered when the arguments to @access are neither public nor private
  56.  */
  57. define("PDERROR_ACCESS_WRONG_PARAM",8);
  58. /**
  59.  * warning triggered when there are multiple @access tags in a docblock
  60.  */
  61. define("PDERROR_MULTIPLE_ACCESS_TAGS",9);
  62. /**
  63.  * warning triggered when there are multiple @return tags in a docblock
  64.  */
  65. define("PDERROR_MULTIPLE_RETURN_TAGS",10);
  66. /**
  67.  * warning triggered when there are multiple @var tags in a docblock
  68.  */
  69. define("PDERROR_MULTIPLE_VAR_TAGS",11);
  70. /**
  71.  * warning triggered when there are multiple @package tags in a docblock
  72.  */
  73. define("PDERROR_MULTIPLE_PACKAGE_TAGS",12);
  74. /**
  75.  * warning triggered when there are multiple @subpackage tags in a docblock
  76.  */
  77. define("PDERROR_MULTIPLE_SUBPACKAGE_TAGS",13);
  78. /**
  79.  * warning triggered when the package or subpackage name is illegal
  80.  */
  81. define("PDERROR_ILLEGAL_PACKAGENAME",14);
  82. /**
  83.  * warning triggered when there a @package tag is used in a function, define, method, var or include
  84.  */
  85. define("PDERROR_OVERRIDDEN_PACKAGE_TAGS",15);
  86. /**
  87.  * warning triggered when there a @subpackage tag is used in a function, define, method, var or include
  88.  */
  89. define("PDERROR_OVERRIDDEN_SUBPACKAGE_TAGS",16);
  90. /**
  91.  * warning triggered when classes in the same package have the same name
  92.  */
  93. define("PDERROR_CLASS_CONFLICT",17);
  94. /**
  95.  * warning triggered when classes in the same package have the same name
  96.  */
  97. define("PDERROR_UNKNOWN_TAG",18);
  98. /**
  99.  * warning triggered when there are multiple @name tags in a docblock
  100.  */
  101. define("PDERROR_MULTIPLE_NAME_TAGS",19);
  102. /**
  103.  * warning triggered when there are multiple @name tags in a docblock
  104.  */
  105. define("PDERROR_PACKAGEOUTPUT_DELETES_PARENT_FILE",20);
  106. /**
  107.  * warning triggered when there are multiple @name tags in a docblock
  108.  */
  109. define("PDERROR_GLOBAL_NOT_FOUND",21);
  110. /**
  111.  * warning triggered when there are multiple @name tags in a docblock
  112.  */
  113. define("PDERROR_MULTIPLE_GLOBAL_TAGS",22);
  114. /**
  115.  * warning triggered when there are multiple @name tags in a docblock
  116.  */
  117. define("PDERROR_MALFORMED_GLOBAL_TAG",23);
  118. /**
  119.  * warning triggered when an @ignore tag is used in a DocBlock preceding a method, variable, include, or global variable
  120.  */
  121. define("PDERROR_IGNORE_TAG_IGNORED",24);
  122. /**
  123.  * warning triggered when a duplicate element is encountered that will be ignored by the documentor
  124.  */
  125. define("PDERROR_ELEMENT_IGNORED",25);
  126. /**
  127.  * warning triggered when an entire page is ignored because of @access private
  128.  */
  129. define("PDERROR_PARSEPRIVATE",26);
  130. /**
  131.  * warning triggered when an entire page is ignored because of @access private
  132.  */
  133. define("PDERROR_UNKNOWN_COMMANDLINE",27);
  134. /**
  135.  * warning triggered when an entire page is ignored because of @access private
  136.  */
  137. define("PDERROR_NEED_WHITESPACE",28);
  138. /**
  139.  * warning triggered when an entire page is ignored because of @access private
  140.  */
  141. define("PDERROR_CLASS_PARENT_NOT_FOUND",29);
  142. /**
  143.  * warning triggered when a getClassByPackage is called and can't find the class
  144.  */
  145. define("PDERROR_CLASS_NOT_IN_PACKAGE",30);
  146. /**
  147.  * warning triggered when a { @source } inline tag is used in a docblock not preceding a function
  148.  */
  149. define("PDERROR_SOURCE_TAG_FUNCTION_NOT_FOUND",31);
  150. /**
  151.  * warning triggered when a docblock template is never turned off with /**#@-* / (no space)
  152.  */
  153. define("PDERROR_DB_TEMPLATE_UNTERMINATED",32);
  154. /**
  155.  * warning triggered when a docblock has an unmatched <ol> or <ul>
  156.  */
  157. define("PDERROR_UNMATCHED_LIST_TAG",33);
  158. /**
  159.  * warning triggered when another tag is nested in <b> - not allowed in phpDocumentor
  160.  */
  161. define("PDERROR_CANT_NEST_IN_B",34);
  162. /**
  163.  * warning triggered when a docbook tag is not properly matched
  164.  */
  165. define("PDERROR_UNMATCHED_TUTORIAL_TAG",35);
  166. /**
  167.  * warning triggered when an inline tag is found inside an xml tag name in a package page
  168.  */
  169. define("PDERROR_CANT_HAVE_INLINE_IN_TAGNAME",36);
  170. /**
  171.  * warning triggered when a tutorial is referenced via @tutorial/{ @tutorial} and is not found
  172.  */
  173. define("PDERROR_TUTORIAL_NOT_FOUND",37);
  174. /**
  175.  * warning triggered when a tutorial lists itself as a child tutorial
  176.  */
  177. define("PDERROR_TUTORIAL_IS_OWN_CHILD",38);
  178. /**
  179.  * warning triggered when a tutorial's child lists the parent tutorial as a child tutorial
  180.  */
  181. define("PDERROR_TUTORIAL_IS_OWN_GRANDPA",39);
  182. /**
  183.  * warning triggered when a tutorial's child in the .ini file doesn't exist in the
  184.  * package and subpackage of the parent
  185.  */
  186. define("PDERROR_CHILD_TUTORIAL_NOT_FOUND",40);
  187. /**
  188.  * warning triggered when a <pdffunction:funcname /> tag is used in the PDF
  189.  * Converter and no funcname is present (<pdffunction: />)
  190.  */
  191. define("PDERROR_PDFFUNCTION_NO_FUNC",41);
  192. /**
  193.  * warning triggered when a <pdffunction:funcname /> tag is used in the PDF
  194.  * Converter and funcname is not a {@link Cezpdf} method
  195.  */
  196. define("PDERROR_PDF_METHOD_DOESNT_EXIST",42);
  197. /**
  198.  * warning triggered when a <pdffunction:funcname arg=$tempvar/> tag is used in the PDF
  199.  * Converter and "tempvar" is not set from the return of a previous pdffunction tag
  200.  */
  201. define("PDERROR_PDF_TEMPVAR_DOESNT_EXIST",43);
  202. /**
  203.  * warning triggered when a subsection's title is asked for, but the subsection is not found
  204.  */
  205. define("PDERROR_TUTORIAL_SUBSECTION_NOT_FOUND",44);
  206. /**
  207.  * warning triggered when a subsection's title is asked for, but the subsection is not found
  208.  */
  209. define("PDERROR_UNTERMINATED_ATTRIB",45);
  210. /**
  211.  * warning triggered when no @package tag is used in a page-level or class-level DocBlock
  212.  */
  213. define("PDERROR_NO_PACKAGE_TAG",46);
  214. /**
  215.  * warning triggered when no @access private tag is used in a global variable/method/var
  216.  * with _ as first char in name and --pear was specified
  217.  */
  218. define("PDERROR_PRIVATE_ASSUMED",47);
  219. /**
  220.  * warning triggered when an example's path from @example /path/to/example.php
  221.  * is not found
  222.  */
  223. define("PDERROR_EXAMPLE_NOT_FOUND",48);
  224. /**
  225.  * warning triggered when an example's path from @example /path/to/example.php
  226.  * is not found
  227.  */
  228. define("PDERROR_NO_CONVERTER_HANDLER",49);
  229. /**
  230.  * warning triggered when an example's path from @example /path/to/example.php
  231.  * is not found
  232.  */
  233. define("PDERROR_INLINETAG_IN_SEE",50);
  234. /**
  235.  * warning triggered when an id attribute in a tutorial docbook tag is not
  236.  * an {@}id} inline tag
  237.  */
  238. define("PDERROR_ID_MUST_BE_INLINE",51);
  239. /**
  240.  * warning triggered when an {@}internal}} tag is not closed
  241.  */
  242. define("PDERROR_INTERNAL_NOT_CLOSED",52);
  243. /**
  244.  * warning triggered when an {@}source} tag is found in a short description
  245.  */
  246. define("PDERROR_SOURCE_TAG_IGNORED",53);
  247. /**
  248.  * warning triggered when a child converter doesn't override getFormattedClassTrees()
  249.  */
  250. define("PDERROR_CONVERTER_OVR_GFCT",54);
  251. /**
  252.  * warning triggered when a package is already associated with a category, and
  253.  * a new association is found
  254.  */
  255. define("PDERROR_PACKAGECAT_SET",55);
  256. /**
  257.  * warning triggered when text in a docblock list is not contained in
  258.  * an <<li>> opening tag
  259.  */
  260. define("PDERROR_TEXT_OUTSIDE_LI",56);
  261. /**
  262.  * warning triggered when a DocBlock html tag is unclosed
  263.  */
  264. define("PDERROR_UNCLOSED_TAG",57);
  265. /**
  266.  * warning triggered by @filesource, if PHP < 4.3.0
  267.  */
  268. define("PDERROR_TAG_NOT_HANDLED",58);
  269. /**
  270.  * warning triggered by sourcecode="on", if PHP < 4.3.0
  271.  */
  272. define("PDERROR_SOURCECODE_IGNORED",59);
  273. /**
  274.  * warning triggered by an empty tag
  275.  */
  276. define("PDERROR_MALFORMED_TAG",60);
  277. /**
  278.  * warning triggered by more than 1 @category tag
  279.  */
  280. define("PDERROR_MULTIPLE_CATEGORY_TAGS",61);
  281. /**
  282.  * warning triggered by {@}inheritdoc} in a non-inheritable situation
  283.  */
  284. define("PDERROR_INHERITDOC_DONT_WORK_HERE",62);
  285. /**
  286.  * warning triggered by @example path/to/example with no title
  287.  */
  288. define("PDERROR_EMPTY_EXAMPLE_TITLE",63);
  289. /**
  290.  * warning triggered by non-existent template directory
  291.  */
  292. define("PDERROR_TEMPLATEDIR_DOESNT_EXIST",64);
  293. /**
  294.  * warning triggered by an unterminated entity in a tutorial
  295.  */
  296. define("PDERROR_UNTERMINATED_ENTITY",65);
  297. /**
  298.  * warning triggered by a function with no name
  299.  *
  300.  * <pre>
  301.  * function ($params)
  302.  * {
  303.  * }
  304.  * </pre>
  305.  * triggers this error
  306.  */
  307. define("PDERROR_FUNCTION_HAS_NONAME",66);
  308. /**
  309.  * warning triggered by a page-level docblock preceding a source element
  310.  *
  311.  * <code>
  312.  * <?php
  313.  * /**
  314.  *  * Page-level DocBlock
  315.  *  * @package pagepackage
  316.  *  *{@*}
  317.  * include 'file.php';
  318.  * </code>
  319.  */
  320. define("PDERROR_DOCBLOCK_CONFLICT", 67);
  321. /**
  322.  * warning triggered when a file does not contain a page-level docblock
  323.  */
  324. define("PDERROR_NO_PAGE_LEVELDOCBLOCK", 68);
  325. /**
  326.  * warning triggered when the first docblock in a file with a @package tag
  327.  * precedes a class.  In this case, the class gets the docblock.
  328.  */
  329. define("PDERROR_DOCBLOCK_GOES_CLASS", 69);
  330. /**
  331.  * warning triggered in tutorial parsing if there is a missing {@id} inline tag
  332.  */
  333. define("PDERROR_NO_DOCBOOK_ID", 70);
  334.  
  335. /**
  336.  * Error messages for phpDocumentor parser warnings
  337.  * @global array $GLOBALS['phpDocumentor_warning_descrip']
  338.  * @name $phpDocumentor_warning_descrip
  339.  */
  340. $GLOBALS['phpDocumentor_warning_descrip'] =
  341.     array(
  342.         PDERROR_MULTIPLE_PARENT => 'Class %s has multiple possible parents, package inheritance aborted',
  343.         PDERROR_PARENT_NOT_FOUND => 'Class %s parent %s not found',
  344.         PDERROR_INHERITANCE_CONFLICT => 'Class %s in file %s has multiple possible parents named %s.  Cannot resolve name conflict,'."\n".' try ignoring a file that contains the conflicting parent class',
  345.         PDERROR_UNKNOWN_TAG => 'Unknown tag "@%s" used',
  346.         PDERROR_IGNORE_TAG_IGNORED => '@ignore tag used for %s element "%s" will be ignored',
  347.         PDERROR_ELEMENT_IGNORED => "\n".'duplicate %s element "%s" in file %s will be ignored.'."\n".'Use an @ignore tag on the original if you want this case to be documented.',
  348.         PDERROR_PARSEPRIVATE => "entire page %s ignored because of @access private.\nChoose -pp to enable parsing of private elements",
  349.         PDERROR_CLASS_PARENT_NOT_FOUND => "class %s in package %s parent not found in @see parent::%s",
  350.         PDERROR_CLASS_NOT_IN_PACKAGE => "class %s was not found in package %s",
  351.         PDERROR_DB_TEMPLATE_UNTERMINATED => "docblock template never terminated with /**#@-*/",
  352.         PDERROR_PDF_METHOD_DOESNT_EXIST => '<pdffunction:%s /> called, but pdf method "%s" doesn\'t exist',
  353.         PDERROR_TUTORIAL_NOT_FOUND => "tutorial \"%s\" not found, does it exist?",
  354.         PDERROR_CHILD_TUTORIAL_NOT_FOUND => 'child tutorial "%s" listed in %s not found in parent package "%s" subpackage "%s"',
  355.         PDERROR_TUTORIAL_SUBSECTION_NOT_FOUND => 'tutorial %s subsection "%s" doesn\'t exist, but its title was asked for',
  356.         PDERROR_NO_PACKAGE_TAG => 'no @package tag was used in a DocBlock for %s %s',
  357.         PDERROR_PRIVATE_ASSUMED => '%s "%s" is assumed to be @access private because its name starts with _, but has no @access tag',
  358.         PDERROR_EXAMPLE_NOT_FOUND => 'example file "%s" does not exist',
  359.         PDERROR_SOURCE_TAG_IGNORED => '{@source} can only be used in the long description, not in the short description: "%s"',
  360.         PDERROR_PACKAGECAT_SET => 'package %s is already in category %s, will now replace with category %s',
  361.         PDERROR_SOURCECODE_IGNORED => 'sourcecode command-line option is ignored for PHP versions < 4.3.0',
  362.         PDERROR_INHERITDOC_DONT_WORK_HERE => '{@inheritdoc} can only be used in the docblock of a child class',
  363.         PDERROR_EMPTY_EXAMPLE_TITLE => 'Example file found at "%s" has no title, using "%s"',
  364.         PDERROR_DOCBLOCK_CONFLICT => 'Page-level DocBlock precedes "%s %s", use another DocBlock to document the source element',
  365.         PDERROR_NO_PAGE_LEVELDOCBLOCK => 'File "%s" has no page-level DocBlock, use @package in the first DocBlock to create one',
  366.         PDERROR_DOCBLOCK_GOES_CLASS => 'DocBlock would be page-level, but precedes class "%s", use another DocBlock to document the file',
  367.         PDERROR_NO_DOCBOOK_ID => 'Tutorial section %s "%s" has no id="{@id subsection}" tag ({@id} for refentry)',
  368.         );
  369.  
  370.  
  371.  
  372. //********************************************************
  373.  
  374.  
  375.  
  376. /**
  377.  * Error messages for phpDocumentor parser errors
  378.  * @global array $GLOBALS['phpDocumentor_error_descrip']
  379.  * @name $phpDocumentor_error_descrip
  380.  */
  381. $GLOBALS['phpDocumentor_error_descrip'] = 
  382.     array(
  383.         PDERROR_UNTERMINATED_INLINE_TAG => 'Inline tag {@%s} in tag %s is unterminated, "%s"',
  384.         PDERROR_CLASS_EXISTS => 'Class %s already exists in package "%s"',
  385.         PDERROR_CONVERTER_NOT_FOUND => 'Converter %s specified by --output command-line option is not a class',
  386.         PDERROR_NO_CONVERTERS => 'No Converters have been specified by --output command-line option',
  387.         PDERROR_ACCESS_WRONG_PARAM => '@access was passed neither "public" nor "private."  Was passed: "%s"',
  388.         PDERROR_MULTIPLE_ACCESS_TAGS => 'DocBlock has multiple @access tags, illegal. ignoring additional tag "@access %s"',
  389.         PDERROR_MULTIPLE_RETURN_TAGS => 'DocBlock has multiple @return tags, illegal. ignoring additional tag "@return %s %s"',
  390.         PDERROR_MULTIPLE_VAR_TAGS => 'DocBlock has multiple @var tags, illegal. ignoring additional tag "@var %s %s"',
  391.         PDERROR_MULTIPLE_PACKAGE_TAGS => 'DocBlock has multiple @package tags, illegal. ignoring additional tag "@package %s"',
  392.         PDERROR_MULTIPLE_SUBPACKAGE_TAGS => 'DocBlock has multiple @subpackage tags, illegal. ignoring additional tag "@subpackage %s"',
  393.         PDERROR_ILLEGAL_PACKAGENAME => '@%s tag has illegal %s name "%s"',
  394.         PDERROR_OVERRIDDEN_PACKAGE_TAGS => '%s %s\'s DocBlock has @package tag, illegal. ignoring tag "@package %s"',
  395.         PDERROR_OVERRIDDEN_SUBPACKAGE_TAGS => '"%s" %s\'s DocBlock has @subpackage tags, illegal. ignoring tag "@subpackage %s"',
  396.         PDERROR_CLASS_CONFLICT => 'class "%s" has multiple declarations in package %s, in file %s and file %s, documentation will have output errors!',
  397.         PDERROR_MULTIPLE_NAME_TAGS => 'DocBlock has multiple @name tags, illegal. ignoring additional tag "@name %s"',
  398.         PDERROR_PACKAGEOUTPUT_DELETES_PARENT_FILE => '-po (packageoutput) option deletes parent file "%s" containing class "%s."'."\n".'  Try using --defaultpackagename (-dn) %s to include the parent file in the same package as the class',
  399.         PDERROR_GLOBAL_NOT_FOUND => 'global variable %s specified in @global tag was never found',
  400.         PDERROR_MULTIPLE_GLOBAL_TAGS => '@global define tag already used for global variable "%s", ignoring @global %s',
  401.         PDERROR_MALFORMED_GLOBAL_TAG => 'incorrect @global syntax.  Should be @global vartype $varname or @global vartype description',
  402.         PDERROR_UNKNOWN_COMMANDLINE => 'Unknown command-line option "%s" encountered, use phpdoc -h for help',
  403.         PDERROR_NEED_WHITESPACE => 'phpDocumentor programmer error - wordparser whitespace set to false in handleDocBlock, notify developers.  You should never see this error',
  404.         PDERROR_SOURCE_TAG_FUNCTION_NOT_FOUND => '{@source} tag used in a docblock that isn\'t preceding a function',
  405.         PDERROR_UNMATCHED_LIST_TAG => 'unmatched ol or ul tag in DocBlock, parsing will be incorrect',
  406.         PDERROR_CANT_NEST_IN_B => 'Can\'t nest a code, pre, ul, or ol tag in a b tag in phpDocumentor DocBlock (%s tag nested)',
  407.         PDERROR_UNMATCHED_TUTORIAL_TAG => 'While parsing extended documentation, "%s" tag was matched with "%s" endtag, missing endtag'."\ntag contents:\"%s\"",
  408.         PDERROR_CANT_HAVE_INLINE_IN_TAGNAME => 'Can\'t have an inline tag inside a package page XML tag!',
  409.         PDERROR_TUTORIAL_IS_OWN_CHILD => 'Tutorial %s lists itself as its own child in %s, illegal',
  410.         PDERROR_TUTORIAL_IS_OWN_GRANDPA => 'Tutorial %s\'s child %s lists %s as its child in %s, illegal',
  411.         PDERROR_PDFFUNCTION_NO_FUNC => 'Invalid pdffunction syntax: "<pdffunction: />", should be "<pdffunction:functionname [arg="value"...]/>"',
  412.         PDERROR_PDF_TEMPVAR_DOESNT_EXIST => '<pdffunction:%s arg=%s /> called but temporary variable "%s" doesn\'t exist',
  413.         PDERROR_UNTERMINATED_ATTRIB => 'Tutorial tag %s attribute %s is unterminated, current value "%s"',
  414.         PDERROR_NO_CONVERTER_HANDLER => 'Handler for element of type "%s" called, but %s is not a method of %s',
  415.         PDERROR_INLINETAG_IN_SEE => 'Inline tags are not allowed in a @see tag',
  416.         PDERROR_ID_MUST_BE_INLINE => '<%s id="%s"> must be <%s id="{@id %s}">',
  417.         PDERROR_INTERNAL_NOT_CLOSED => '{@internal was never terminated with }}',
  418.         PDERROR_CONVERTER_OVR_GFCT => 'Converter "%s" must override getFormattedClassTrees() but doesn\'t',
  419.         PDERROR_TEXT_OUTSIDE_LI => 'Text cannot be outside of li tag in a DocBlock list, parsing will be incorrect',
  420.         PDERROR_UNCLOSED_TAG => 'Unclosed %s tag in DocBlock, parsing will be incorrect',
  421.         PDERROR_TAG_NOT_HANDLED => '"%s" tag is not available in PHP versions less than 4.3.0, tag ignored',
  422.         PDERROR_MALFORMED_TAG => '"%s" tag was used without any parameters, illegal',
  423.         PDERROR_MULTIPLE_CATEGORY_TAGS => 'package has multiple @category tags, ignoring "@category %s"',
  424.         PDERROR_TEMPLATEDIR_DOESNT_EXIST => 'template directory "%s" does not exist',
  425.         PDERROR_UNTERMINATED_ENTITY => 'entity &%s is unterminated',
  426.         PDERROR_FUNCTION_HAS_NONAME => 'function has no name (PHP error - test your file before parsing!)',
  427.         );
  428.  
  429. /**
  430.  * encapsulates warning information
  431.  * @package phpDocumentor
  432.  * @subpackage Errors
  433.  */
  434. class RecordWarning
  435. {
  436.     /**
  437.      * name of global variable that descriptors for this warning/error is kept
  438.      * @var string
  439.      */
  440.     var $type = 'phpDocumentor_warning_descrip';
  441.     /**
  442.      * file this error occurred in
  443.      * @var string
  444.      */
  445.     var $file = false;
  446.     /**
  447.      * line number of the file this error occurred in
  448.      * @var integer
  449.      */
  450.     var $linenum;
  451.     /**
  452.      * error string
  453.      * @var string
  454.      */
  455.     var $data;
  456.     /**
  457.      * error number
  458.      * @see Errors.inc
  459.      * @var string
  460.      */
  461.     var $num;
  462.     /**
  463.      * @param string $file filename this error occurred in ({@link $file})
  464.      * @param integer $linenum line number this error occurred on ({@link $linenum})
  465.      * @param integer $num Error number defined in {@link Errors.inc}
  466.      * @param string $data... variable number of strings, up to 4, to sprintf based on the error number
  467.      */
  468.     function RecordWarning($file,$linenum,$num)
  469.     {
  470.         $this->file = $file;
  471.         $this->linenum = $linenum;
  472.         $a = array('','','','');
  473.         if (func_num_args()>3)
  474.         {
  475.             for($i=3;$i<func_num_args();$i++)
  476.             {
  477.                 $a[$i - 3] = func_get_arg($i);
  478.             }
  479.         }
  480.  
  481.         $this->num = $num;
  482.         $this->data = sprintf($GLOBALS[$this->type][$this->num],$a[0],$a[1],$a[2],$a[3]);
  483.         $this->output();
  484.     }
  485.     
  486.     /**
  487.      * prints the warning
  488.      */
  489.     function output($string = false)
  490.     {
  491.         if ($string)
  492.         {
  493.             if ($this->file)
  494.             return "WARNING in $this->file on line $this->linenum: $this->data\n";
  495.             else
  496.             return "WARNING: $this->data\n";
  497.         }
  498.         if ($this->file)
  499.         phpDocumentor_out("WARNING in $this->file on line $this->linenum: $this->data\n");
  500.         else
  501.         phpDocumentor_out("WARNING: $this->data\n");
  502.         flush();
  503.     }
  504. }
  505.  
  506. /**
  507.  * encapsulates error information
  508.  * @package phpDocumentor
  509.  * @subpackage Errors
  510.  */
  511. class RecordError extends RecordWarning
  512. {
  513.     /**
  514.      * name of global variable that descriptors for this warning/error is kept
  515.      * @var string
  516.      */
  517.     var $type = 'phpDocumentor_error_descrip';
  518.  
  519.     /**
  520.      * prints the error
  521.      */
  522.     function output($string = false)
  523.     {
  524.         if ($string)
  525.         {
  526.             if ($this->file)
  527.             return "\n\tERROR in $this->file on line $this->linenum: $this->data\n";
  528.             else
  529.             return "\n\tERROR: $this->data\n";
  530.         }
  531.         if ($this->file)
  532.         phpDocumentor_out("\n\tERROR in $this->file on line $this->linenum: $this->data\n");
  533.         else
  534.         phpDocumentor_out("\n\tERROR: $this->data\n");
  535.         flush();
  536.     }
  537. }
  538.  
  539. /**
  540.  * contains all the errors/warnings
  541.  * @see $errors, $warnings
  542.  * @package phpDocumentor
  543.  * @subpackage Errors
  544.  */
  545. class ErrorTracker
  546. {
  547.     /**
  548.      * array of {@link RecordError}s
  549.      * @var array
  550.      */
  551.     var $errors = array();
  552.     /**
  553.      * array of {@link RecordWarning}s
  554.      * @var array
  555.      */
  556.     var $warnings = array();
  557.     /**
  558.      * @var string
  559.      */
  560.     var $curfile = '';
  561.     /**
  562.      * @var integer
  563.      */
  564.     var $linenum = 0;
  565.     
  566.     /**
  567.      * index in {@link $errors} of last error triggered
  568.      * @var integer|false
  569.      */
  570.     var $lasterror = false;
  571.     
  572.     /**
  573.      * index in {@link $warnings} of last warning triggered
  574.      * @var integer|false
  575.      */
  576.     var $lastwarning = false;
  577.     
  578.     /**
  579.      * This function subscribes to two events in the Parser in order to keep track of line number information and file name.
  580.      * @param integer $num parser-passed event (see {@link PHPDOCUMENTOR_EVENT_NEWLINENUM, PHPDOCUMENTOR_EVENT_NEWFILE})
  581.      * @param mixed $data either a line number if $num is PHPDOCUMENTOR_EVENT_NEWLINENUM or a file name if $num is PHPDOCUMENTOR_EVENT_NEWFILE
  582.      */
  583.     function handleEvent($num,$data)
  584.     {
  585.         switch($num)
  586.         {
  587.             case PHPDOCUMENTOR_EVENT_NEWLINENUM :
  588.                 $this->linenum = $data;
  589.             break;
  590.             case PHPDOCUMENTOR_EVENT_NEWFILE :
  591.                 $this->linenum = 0;
  592.                 $this->curfile = $data;
  593.             break;
  594.             // debugging
  595.             case 1000000635 :
  596.                 phpDocumentor_out($this->curfile.' has '.$this->linenum.' lines'."\n");
  597.                 flush();
  598.             break;
  599.         }
  600.     }
  601.  
  602.     /**
  603.      * add a new warning to the {@link $warnings} array
  604.      * @param integer $num error number from {@link Errors.inc}
  605.      * @param string $data... up to 4 string parameters to sprintf() into the error string for error number $num
  606.      */
  607.     function addWarning($num)
  608.     {
  609.         $a = array('','','','');
  610.         if (func_num_args()>1)
  611.         {
  612.             for($i=1;$i<func_num_args();$i++)
  613.             {
  614.                 $a[$i - 1] = func_get_arg($i);
  615.             }
  616.         }
  617.         $this->warnings[] = new RecordWarning($this->curfile,$this->linenum,$num,$a[0],$a[1],$a[2],$a[3]);
  618.         $this->lastwarning = count($this->warnings) - 1;
  619.     }
  620.  
  621.     /**
  622.      * add a new error to the {@link $errors} array
  623.      * @param integer $num error number from {@link Errors.inc}
  624.      * @param string $data... up to 4 string parameters to sprintf() into the error string for error number $num
  625.      */
  626.     function addError($num)
  627.     {
  628.         $a = array('','','','');
  629.         if (func_num_args()>1)
  630.         {
  631.             for($i=1;$i<func_num_args();$i++)
  632.             {
  633.                 $a[$i - 1] = func_get_arg($i);
  634.             }
  635.         }
  636.         $this->errors[] = new RecordError($this->curfile,$this->linenum,$num,$a[0],$a[1],$a[2],$a[3]);
  637.         $this->lasterror = count($this->errors) - 1;
  638.     }
  639.     
  640.     /**
  641.      * add a new error to the {@link $errors} array and returns the error string
  642.      * @param integer $num error number from {@link Errors.inc}
  643.      * @param string $data... up to 4 string parameters to sprintf() into the error string for error number $num
  644.      */
  645.     function addErrorReturn($num)
  646.     {
  647.         $a = array('','','','');
  648.         if (func_num_args()>1)
  649.         {
  650.             for($i=1;$i<func_num_args();$i++)
  651.             {
  652.                 $a[$i - 1] = func_get_arg($i);
  653.             }
  654.         }
  655.         $this->errors[] = new RecordError($this->curfile,$this->linenum,$num,$a[0],$a[1],$a[2],$a[3],false);
  656.         $this->lasterror = count($this->errors) - 1;
  657.     }
  658.     
  659.     /**
  660.      * Get sorted array of all warnings in parsing/conversion
  661.      * @return array
  662.      */
  663.     function &returnWarnings()
  664.     {
  665.         usort($this->warnings,array($this,"errorsort"));
  666.         return $this->warnings;
  667.     }
  668.     
  669.     /**
  670.      * Get sorted array of all non-fatal errors in parsing/conversion
  671.      * @return array
  672.      */
  673.     function &returnErrors()
  674.     {
  675.         usort($this->errors,array($this,"errorsort"));
  676.         return $this->errors;
  677.     }
  678.     
  679.     /**
  680.      * @access private
  681.      * @param RecordError|RecordWarning
  682.      * @param RecordError|RecordWarning
  683.      */
  684.     function errorsort($a, $b)
  685.     {
  686.         if (!$a->file) return -1;
  687.         if (!$b->file) return 1;
  688.         if ($a->file == $b->file)
  689.         {
  690.             if ($a->linenum == $b->linenum) return 0;
  691.             if ($a->linenum < $b->linenum) return -1;
  692.             return 1;
  693.         }
  694.         return strnatcasecmp($a->file,$b->file);
  695.     }
  696.     
  697.     /**
  698.      * Get the error message of the last error
  699.      * @return string
  700.      */
  701.     function returnLastError()
  702.     {
  703.         return $this->errors[$this->lasterror]->output(true);
  704.     }
  705.  
  706.     /**
  707.      * Get the warning message of the last warning
  708.      * @return string
  709.      */
  710.     function returnLastWarning()
  711.     {
  712.         return $this->warnings[$this->lastwarning]->output(true);
  713.     }
  714. }
  715.  
  716. /**
  717.  * @global ErrorTracker $GLOBALS['phpDocumentor_errors']
  718.  * @name $phpDocumentor_errors
  719.  */
  720. $GLOBALS['phpDocumentor_errors'] = new ErrorTracker;
  721.  
  722. /**
  723.  * @param integer $num error number from {@link Errors.inc}
  724.  * @param string $data... up to 4 string parameters to sprintf() into the error string for error number $num
  725.  * @see ErrorTracker::addError()
  726.  */
  727. function addError($num)
  728. {
  729.     global $phpDocumentor_errors;
  730.     $a = array('','','','');
  731.     if (func_num_args()>1)
  732.     {
  733.         for($i=1;$i<func_num_args();$i++)
  734.         {
  735.             $a[$i - 1] = func_get_arg($i);
  736.         }
  737.     }
  738.     $phpDocumentor_errors->addError($num,$a[0],$a[1],$a[2],$a[3]);
  739. }
  740.  
  741. /**
  742.  * like {@link addError()} but exits parsing
  743.  * @param integer $num error number from {@link Errors.inc}
  744.  * @param string $data... up to 4 string parameters to sprintf() into the error string for error number $num
  745.  * @global ErrorTracker repository for all errors generated by phpDocumentor
  746.  * @see ErrorTracker::addError()
  747.  */
  748. function addErrorDie($num)
  749. {
  750.     global $phpDocumentor_errors;
  751.     $a = array('','','','');
  752.     if (func_num_args()>1)
  753.     {
  754.         for($i=1;$i<func_num_args();$i++)
  755.         {
  756.             $a[$i - 1] = func_get_arg($i);
  757.         }
  758.     }
  759.     $phpDocumentor_errors->addErrorReturn($num,$a[0],$a[1],$a[2],$a[3]);
  760.     die($phpDocumentor_errors->returnLastError());
  761. }
  762.  
  763. /**
  764.  * @param integer $num warning number from {@link Errors.inc}
  765.  * @param string $data... up to 4 string parameters to sprintf() into the error string for error number $num
  766.  * @global ErrorTracker repository for all errors generated by phpDocumentor
  767.  * @see ErrorTracker::addWarning()
  768.  */
  769. function addWarning($num)
  770. {
  771.     global $phpDocumentor_errors;
  772.     $a = array('','','','');
  773.     if (func_num_args()>1)
  774.     {
  775.         for($i=1;$i<func_num_args();$i++)
  776.         {
  777.             $a[$i - 1] = func_get_arg($i);
  778.         }
  779.     }
  780.  
  781.     $phpDocumentor_errors->addWarning($num,$a[0],$a[1],$a[2],$a[3]);
  782. }
  783. ?>
  784.