engine === null) { $this->engine = new RuleEngine(); } } public function addRule(mixed $rule): void { $this->engine->addRule($rule); } /** * Scan HTML content for accessibility violations. * * @param string $html * @return Violation[] */ public function scan(string $html): array { if (empty(trim($html))) { return []; } $doc = new \DOMDocument(); // Suppress warnings for malformed HTML @$doc->loadHTML('' . $html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); return $this->engine->run($doc); } }