36        $currentErrors = libxml_get_errors();
 
   37        libxml_clear_errors();
 
   39        $level = count(self::$errorStack) - 1;
 
   40        self::$errorStack[$level] = array_merge(self::$errorStack[$level], $currentErrors);
 
   54        if (!function_exists(
'libxml_use_internal_errors')) {
 
   58        if (count(self::$errorStack) === 0) {
 
   60            self::$xmlErrorState = libxml_use_internal_errors(
true);
 
   61            libxml_clear_errors();
 
   70        self::$errorStack[] = array();
 
   79    public static function end()
 
   83        if (!function_exists(
'libxml_use_internal_errors')) {
 
   92        $ret = array_pop(self::$errorStack);
 
   94        if (count(self::$errorStack) === 0) {
 
   96            libxml_use_internal_errors(self::$xmlErrorState);
 
  113        assert($error instanceof LibXMLError);
 
  114        return 'level=' . $error->level . 
',code='  . $error->code . 
',line=' . $error->line . 
',col=' . $error->column .
 
  115            ',msg=' . trim($error->message);
 
An exception for terminatinating execution or to throw for unit testing.
static addErrors()
Append current XML errors to the current stack level.
static formatErrors($errors)
Format a list of errors as a string.
static begin()
Start error logging.
static formatError($error)
Format an error as a string.
static end()
End error logging.