phpDocumentor
[ class tree: phpDocumentor ] [ index: phpDocumentor ] [ all elements ]

Source for file Errors.inc

Documentation is available at Errors.inc

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

Documentation generated on Mon, 11 Mar 2019 15:08:04 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.