ILIAS  release_8 Revision v8.24
class.ilDomDocument.php
Go to the documentation of this file.
1<?php
2
25{
26 private DOMDocument $doc;
27 private array $errors = array();
28
33 public function __construct()
34 {
35 $this->doc = new DOMDocument();
36 }
37
38 public function __call(string $a_method, array $a_args)
39 {
40 if (in_array($a_method, array("validate", "loadXML"))) {
41 set_error_handler(array($this, "handleError"));
42 $rv = call_user_func_array(array($this->doc, $a_method), $a_args);
43 restore_error_handler();
44 return $rv;
45 } else {
46 return call_user_func_array(array($this->doc, $a_method), $a_args);
47 }
48 }
49
50 public function getErrors(): array
51 {
52 return $this->errors;
53 }
54
55 public function handleError(
56 int $a_no,
57 string $a_string,
58 string $a_file = null,
59 int $a_line = null,
60 array $a_context = null
61 ): void {
62 $pos = strpos($a_string, "]:");
63 $err = trim(substr($a_string, $pos + 2));
64 $this->errors[] = $err;
65 }
66}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__call(string $a_method, array $a_args)
handleError(int $a_no, string $a_string, string $a_file=null, int $a_line=null, array $a_context=null)
__construct()
Constructor.