1<?
php declare(strict_types=1);
25 public function isValid() : bool
27 if (!preg_match(
'/<[^>]+?>/', $this->text)) {
32 $dom =
new DOMDocument();
33 if (!$dom->loadHTML($this->text)) {
37 $iter =
new RecursiveIteratorIterator(
39 RecursiveIteratorIterator::SELF_FIRST
41 foreach ($iter as $element) {
43 if (in_array(strtolower($element->nodeName), [
'body'])) {
47 if ($element->nodeType === XML_ELEMENT_NODE) {
53 }
catch (Exception
$e) {
55 }
catch (Throwable
$e) {
An exception for terminatinating execution or to throw for unit testing.
Class ilHtmlDomNodeIterator.
Class ilTermsOfServiceDocumentsContainsHtmlValidator.
__construct(string $text)
ilTermsOfServiceDocumentsContainsHtmlValidator constructor.