MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / Parse

Method Parse

tools/profiler/php/ProfFileParser.class.php:16–37  ·  view source on GitHub ↗
(string $file)

Source from the content-addressed store, hash-verified

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 {

Callers 4

DoMatchImplMethod · 0.45
ProfileReportMethod · 0.45
CompareMethod · 0.45
CompareMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected