File "Errors.php"

Full Path: /home/aiclgcwq/photonindustriespvt.com/wp-content/plugins/tenweb-speed-optimizer/vendor/imangazaliev/didom/src/DiDom/Errors.php
File size: 887 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

namespace DiDom;

class Errors
{
    /**
     * @var bool
     */
    protected static $internalErrors;

    /**
     * @var bool
     */
    protected static $disableEntities;

    /**
     * Disable error reporting.
     */
    public static function disable()
    {
        self::$internalErrors = libxml_use_internal_errors(true);

        if (\LIBXML_VERSION < 20900) {
            self::$disableEntities = libxml_disable_entity_loader(true);
        }
    }

    /**
     * Restore error reporting.
     * 
     * @param bool $clear
     */
    public static function restore($clear = true)
    {
        if ($clear) {
            libxml_clear_errors();
        }

        libxml_use_internal_errors(self::$internalErrors);

        if (\LIBXML_VERSION < 20900) {
            libxml_disable_entity_loader(self::$disableEntities);
        }
    }
}