24 public function isValid() : bool
26 if (!preg_match(
'/<[^>]+?>/', $this->text)) {
31 $dom =
new DOMDocument();
32 if (!$dom->loadHTML($this->text)) {
36 $iter =
new RecursiveIteratorIterator(
38 RecursiveIteratorIterator::SELF_FIRST
40 foreach ($iter as $element) {
42 if (in_array(strtolower($element->nodeName), [
'body'])) {
46 if ($element->nodeType === XML_ELEMENT_NODE) {
52 }
catch (Exception
$e) {
54 }
catch (Throwable
$e) {
An exception for terminatinating execution or to throw for unit testing.
Class ilAccessibilityDocumentsContainsHtmlValidator.
__construct(string $text)
ilAccessibilityDocumentsContainsHtmlValidator constructor.
Class ilHtmlDomNodeIterator.