(string $file)
| 14 | public string $last_error; |
| 15 | |
| 16 | public function Parse(string $file): bool|ProfReport |
| 17 | { |
| 18 | $this->report = false; |
| 19 | $this->curtype = false; |
| 20 | |
| 21 | if (($contents = file_get_contents($file)) === false) { |
| 22 | $this->last_error = 'File not found'; |
| 23 | return false; |
| 24 | } |
| 25 | |
| 26 | $xml = xml_parser_create(); |
| 27 | xml_set_object($xml, $this); |
| 28 | xml_set_element_handler($xml, 'tag_open', 'tag_close'); |
| 29 | xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, false); |
| 30 | |
| 31 | if (!xml_parse($xml, $contents)) { |
| 32 | $this->last_error = 'Line: ' . xml_get_current_line_number($xml) . ' -- ' . xml_error_string(xml_get_error_code($xml)); |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | return $this->report; |
| 37 | } |
| 38 | |
| 39 | public function tag_open($parser, string $tag, array $attrs): void |
| 40 | { |
no outgoing calls
no test coverage detected