Automattic\WooCommerce\Internal\StockNotifications\Utilities

EmailNormalizer{} │ final │ WC 1.0

Canonical form for customer emails stored in stock notifications.

Lookups on wc_stock_notifications.user_email use plain SQL equality, so every write and every query must go through the same normalization or the same customer can appear more than once under a different letter case.

No Hooks.

Usage

$EmailNormalizer = new EmailNormalizer();
// use class methods

Methods

  1. public static normalize( string $email )

EmailNormalizer{} code WC 11.3.0

final class EmailNormalizer {

	/**
	 * Normalize an already validated email address.
	 *
	 * Trims and lowercases. No validation is performed.
	 *
	 * @param string $email The email address.
	 * @return string
	 */
	public static function normalize( string $email ): string {
		return strtolower( trim( $email ) );
	}
}