public function process($html = '', &$out = '')
{
$errors = $this->tidyErrors($html, $out);
if (!$errors) {
return [];
}
$result = ['Error' => [], 'Warning' => [], 'Misc' => []];
$errors = explode("\n", $errors);
$markup = explode("\n", $out);
foreach ($errors as $error) {
preg_match('@line (\\d+) column (\\d+) - (\\w+): (.*)@', $error, $matches);
if ($matches) {
list($original, $line, $column, $type, $message) = $matches;
$line = $line - 1;
$string = '</strong>';
if (isset($markup[$line - 1])) {
$string .= h($markup[$line - 1]);
}
$string .= '<strong>' . h(@$markup[$line]) . '</strong>';
if (isset($markup[$line + 1])) {
$string .= h($markup[$line + 1]);
}
$string .= '</strong>';
$result[$type][$string][] = h($message);
} elseif ($error) {
$message = $error;
$result['Misc'][h($message)][] = h($message);
}
}
$this->results = $result;
return $result;
}