Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce
Coupon_Code_Generator::parse_email_restrictions
Parse and validate email restrictions string.
Метод класса: Coupon_Code_Generator{}
Хуков нет.
Возвращает
array. Array of valid email addresses.
Использование
// private - только в коде основоного (родительского) класса $result = $this->parse_email_restrictions( $raw ): array;
- $raw(разное) (обязательный)
- Raw email restrictions value (comma-separated string).
Код Coupon_Code_Generator::parse_email_restrictions() Coupon Code Generator::parse email restrictions WC 11.2.2
private function parse_email_restrictions( $raw ): array {
if ( ! is_string( $raw ) || '' === $raw ) {
return array();
}
$emails = array_map( 'trim', explode( ',', $raw ) );
return array_values(
array_filter(
$emails,
function ( string $email ): bool {
return (bool) is_email( $email );
}
)
);
}