Automattic\WooCommerce\Internal\PushNotifications\Entities

PushToken::set_idpublicWC 10.4.0

Validates and sets the ID.

Method of the class: PushToken{}

No Hooks.

Returns

null. Nothing (null).

Usage

$PushToken = new PushToken();
$PushToken->set_id( $id ): void;
$id(int) (required)
The ID of the token post.

Changelog

Since 10.4.0 Introduced.

PushToken::set_id() code WC 10.8.1

public function set_id( int $id ): void {
	$result = PushTokenValidator::validate( compact( 'id' ), array( 'id' ) );

	if ( is_wp_error( $result ) ) {
		// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
		throw new PushTokenInvalidDataException( $result->get_error_message() );
	}

	$this->id = $id;
}