Automattic\WooCommerce\Internal\PushNotifications\Entities

PushToken::set_originpublicWC 10.4.0

Validates and sets the origin.

Method of the class: PushToken{}

No Hooks.

Returns

null. Nothing (null).

Usage

$PushToken = new PushToken();
$PushToken->set_origin( $origin ): void;
$origin(string) (required)
The origin of the token, e.g. the app it came from.

Changelog

Since 10.4.0 Introduced.

PushToken::set_origin() code WC 10.8.1

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

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

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