Automattic\WooCommerce\Internal\OrderWithdrawal

OrderWithdrawalFormProcessor::get_rate_limit_ids │ private │ WC 1.0

Get order withdrawal rate limit identifiers for the current request.

Method of the class: OrderWithdrawalFormProcessor{}

No Hooks.

Returns

string[].

Usage

// private - for code of main (parent) class only
$result = $this->get_rate_limit_ids( $data ): array;
$data(array<string,string>) (required)
Form data.

OrderWithdrawalFormProcessor::get_rate_limit_ids() code WC 11.1.2

private function get_rate_limit_ids( array $data ): array {
	$rate_limit_ids = array();
	$ip_address     = WC_Geolocation::get_ip_address();
	$email          = strtolower( trim( $data[ self::FIELD_EMAIL ] ) );

	if ( '' !== $ip_address ) {
		$rate_limit_ids[] = self::RATE_LIMIT_IP_PREFIX . hash( 'sha256', $ip_address );
	}

	if ( '' !== $email ) {
		$rate_limit_ids[] = self::RATE_LIMIT_EMAIL_PREFIX . hash( 'sha256', $email );
	}

	return $rate_limit_ids;
}