3 * Extracts the warnings from PHPDoc warnings_* files.
\r
6 class PhpdocWarningAccessor extends PhpdocAccessor {
\r
9 * If set to true all get_xy() functions will free their resources.
\r
13 var $freeOnGet = true;
\r
16 * Array of warnings.
\r
19 var $warnings = array();
\r
22 * Flag used to detect if get_xy() was called.s
\r
25 var $flag_build = false;
\r
28 * Returns a hash of warnings in of the given XML file.
\r
30 * @param string XML file
\r
35 function getWarnings($xmlfile) {
\r
37 $this->buildWarnings($xmlfile);
\r
39 if ($this->freeOnGet) {
\r
41 $data = $this->warnings;
\r
42 $this->warnings = array();
\r
47 return $this->warnings;
\r
51 } // end func getWarnings
\r
54 * Build the internal list of warnings.
\r
56 * @param string XML file to load
\r
58 function buildWarnings($xmlfile) {
\r
60 if ($this->flag_build)
\r
63 $this->flag_build = true;
\r
64 $this->warnings = array();
\r
65 $this->loadXMLFile($xmlfile);
\r
67 if(!isset($this->xml["warnings"][0]))
\r
68 $this->xml["warnings"] = array( $this->xml["warnings"] );
\r
70 reset($this->xml["warnings"]);
\r
71 while (list($k, $warnings)=each($this->xml["warnings"])) {
\r
73 $file = $warnings["file"];
\r
74 if (!isset($warnings["warning"][0]))
\r
75 $warnings["warning"] = array($warnings["warning"]);
\r
76 $this->warnings[$file] = $warnings["warning"];
\r
82 } // end func buildWarnings
\r
85 $this->flag_build = false;
\r
88 } // end class PhpdocWarningAccess
\r