/** * Returns array as severity > line > column > message. * * @return string[] */ public function getErrors() { $this->m_tidy->diagnose(); $matches = []; preg_match_all('/^(?:line (\\d+) column (\\d+) - )?(\\S+): (?:\\[((?:\\d+\\.?){4})]:)?(.*?)$/m', $this->m_tidy->errorBuffer, $matches, PREG_SET_ORDER); $errors = []; if (false === isset($matches[0])) { return $errors; } foreach ($matches as $match) { $match[5] = \str\trim(\html\strip($match[5])); if ($this->ignoreProprietaryAttributes && \str\startsWithIgnoreCase($match[5], 'proprietary attribute')) { continue; } $levelTidy = strtolower(trim($match[3])); $level = self::ERROR; if (isset(self::$m_severities[$levelTidy])) { $level = self::$m_severities[$levelTidy]; } $errors[$level][(int) $match[1]][(int) $match[2]] = $match[5]; } return $errors; }
/** * @see \str\startsWithIgnoreCase() startsWithIgnoreCase */ public static function startsWithIgnoreCase($string0_, $string1_) { return \str\startsWithIgnoreCase($string0_, $string1_); }