public function getAttributes()
{
libxml_use_internal_errors(true);
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->resolveExternals = false;
$dom->validateOnParse = true;
$dom->preserveWhiteSpace = false;
$dom->strictErrorChecking = true;
$dom->recover = true;
// set_error_handler(function ($severity, $message) {
// restore_error_handler();
// });
@$dom->loadHTML($this->normalize($this->html));
// restore_error_handler();
$errors = array_filter(libxml_get_errors(), function (LibXMLError $error) {
return in_array((int) $error->code, static::$ignoreErrors, true) === false;
});
libxml_clear_errors();
return ['severenity' => static::$severenity, 'counter' => count($errors), 'errors' => $errors, 'html' => $this->html];
}