Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailTemplateSelectiveApplier::normalize_for_comparison
Whitespace-normalize block markup for semantic comparison. Trims and collapses runs of whitespace adjacent to tag boundaries — covers the leading/trailing newlines and the spaces inside <div> ##WOO_CONTENT## </div> that serialize_blocks() reproduce from a hand-authored PHP template.
Method of the class: WCEmailTemplateSelectiveApplier{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WCEmailTemplateSelectiveApplier::normalize_for_comparison( $content ): string;
- $content(string) (required)
- Block markup.
WCEmailTemplateSelectiveApplier::normalize_for_comparison() WCEmailTemplateSelectiveApplier::normalize for comparison code WC 10.9.1
private static function normalize_for_comparison( string $content ): string {
$content = trim( $content );
$content = (string) preg_replace( '/>\s+/', '>', $content );
$content = (string) preg_replace( '/\s+</', '<', $content );
return $content;
}