Automattic\WooCommerce\Internal\PushNotifications\Entities

PushToken::set_platformpublicWC 10.4.0

Validates and sets the platform.

Method of the class: PushToken{}

No Hooks.

Returns

null. Nothing (null).

Usage

$PushToken = new PushToken();
$PushToken->set_platform( $platform ): void;
$platform(string) (required)
The platform the token was generated by.

Changelog

Since 10.4.0 Introduced.

PushToken::set_platform() code WC 10.8.1

public function set_platform( string $platform ): void {
	$result = PushTokenValidator::validate( compact( 'platform' ), array( 'platform' ) );

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

	$this->platform = trim( $platform );
}