Automattic\WooCommerce\EmailEditor\Engine
Send_Preview_Email::validate_data
Validates the provided data array.
Method of the class: Send_Preview_Email{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->validate_data( $data );
- $data(array) (required)
- The data array to be validated.
Send_Preview_Email::validate_data() Send Preview Email::validate data code WC 10.5.0
private function validate_data( array $data ) {
if ( empty( $data['email'] ) || empty( $data['postId'] ) ) {
throw new \InvalidArgumentException( esc_html__( 'Missing required data', 'woocommerce' ) );
}
if ( ! is_email( $data['email'] ) ) {
throw new \InvalidArgumentException( esc_html__( 'Invalid email', 'woocommerce' ) );
}
}