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.

Хуков нет.

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

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

Методы

  1. public static normalize( string $email )

Код EmailNormalizer{} WC 11.2.2

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 ) );
	}
}