email = (string) $email; $this->first_name = $first_name ? (string) $first_name : null; $this->last_name = $last_name ? (string) $last_name : null; $this->consent = (bool) $consent; $this->source_reference = $source_reference ? (string) $source_reference : null; $this->destination_form_public_id = $destination_form_public_id ? (string) $destination_form_public_id : null; $this->idempotency_key = (string) $idempotency_key; $this->consent_text = is_string( $consent_text ) && '' !== trim( $consent_text ) ? $consent_text : null; // Not given (false): the page being used right now. A retry passes the stored value (or null). $this->locale = false === $locale ? Site_Language::current() : Site_Language::normalize( $locale ); } public function is_valid() { return '' !== trim( $this->email ) && false !== strpos( $this->email, '@' ) && '' !== trim( $this->idempotency_key ); } }