Automattic\WooCommerce\Internal\PushNotifications\Services
PendingNotificationStore::dispatch_all
Dispatches all pending notifications via the loopback endpoint.
Called on shutdown. Sends all pending notifications through the InternalNotificationDispatcher, then clears the store.
Method of the class: PendingNotificationStore{}
No Hooks.
Returns
null. Nothing (null).
Usage
$PendingNotificationStore = new PendingNotificationStore(); $PendingNotificationStore->dispatch_all(): void;
Changelog
| Since 10.7.0 | Introduced. |
PendingNotificationStore::dispatch_all() PendingNotificationStore::dispatch all code WC 10.7.0
public function dispatch_all(): void {
if ( empty( $this->pending ) ) {
return;
}
/**
* Fires when pending push notifications are ready to be dispatched.
*
* @param Notification[] $notifications The notifications to dispatch.
*
* @since 10.7.0
*
* The call to dispatch the notifications will go here when the
* receiving controller has been added.
*/
/**
* Store is single-use per request lifecycle, so disable it and clear
* pending notifications.
*/
$this->enabled = false;
$this->pending = array();
}