Automattic\WooCommerce\Internal\PushNotifications\Entities
PushToken::set_token
Validates and sets the token.
Method of the class: PushToken{}
No Hooks.
Returns
null. Nothing (null).
Usage
$PushToken = new PushToken(); $PushToken->set_token( $token ): void;
- $token(string) (required)
- The token representing a device we can send a push notification to.
Changelog
| Since 10.4.0 | Introduced. |
PushToken::set_token() PushToken::set token code WC 10.8.1
public function set_token( string $token ): void {
$result = PushTokenValidator::validate( compact( 'token' ), array( 'token' ) );
if ( is_wp_error( $result ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw new PushTokenInvalidDataException( $result->get_error_message() );
}
$this->token = trim( $token );
}