Automattic\WooCommerce\Internal\PushNotifications\Notifications

Notification::__constructpublicWC 10.7.0

Creates a new Notification instance.

Method of the class: Notification{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Notification = new Notification();
$Notification->__construct( $type, $resource_id );
$type(string) (required)
The notification type.
$resource_id(int) (required)
The resource ID.

Changelog

Since 10.7.0 Introduced.

Notification::__construct() code WC 10.7.0

public function __construct( string $type, int $resource_id ) {
	if ( '' === trim( $type ) ) {
		throw new InvalidArgumentException( 'Notification type must not be empty.' );
	}

	if ( $resource_id <= 0 ) {
		throw new InvalidArgumentException( 'Notification resource_id must be positive.' );
	}

	$this->type        = trim( $type );
	$this->resource_id = $resource_id;
}