Automattic\WooCommerce\Vendor\Pelago\Emogrifier\HtmlProcessor

AbstractHtmlProcessor::normalizeDocumentType │ private │ WC 1.0

Makes sure the document type in the passed HTML has lowercase "html".

Метод класса: AbstractHtmlProcessor{}

Хуков нет.

Возвращает

string. HTML with normalized document type

Использование

// private - только в коде основоного (родительского) класса
$result = $this->normalizeDocumentType( $html ): string;
$html(строка) (обязательный)
.

Код AbstractHtmlProcessor::normalizeDocumentType() WC 11.2.1

private function normalizeDocumentType(string $html): string
{
    // Limit to replacing the first occurrence: as an optimization; and in case an example exists as unescaped text.
    return (new Preg())->replace(
        '/<!DOCTYPE\\s++html(?=[\\s>])/i',
        '<!DOCTYPE html',
        $html,
        1
    );
}