Automattic\WooCommerce\Admin\RemoteInboxNotifications
RemoteInboxNotificationsDataSourcePoller::get_published_snapshot
Get the published identities from the latest complete canonical response.
Inconclusive reads store their fetch time with null slugs to reject older reads, but this method returns null for them.
Method of the class: RemoteInboxNotificationsDataSourcePoller{}
No Hooks.
Returns
array{fetched_at: int, slugs: string[]}|null. The snapshot, or null when the latest read is inconclusive or absent.
Usage
$RemoteInboxNotificationsDataSourcePoller = new RemoteInboxNotificationsDataSourcePoller(); $RemoteInboxNotificationsDataSourcePoller->get_published_snapshot(): ?array;
Changelog
| Since 11.3.0 | Introduced. |
RemoteInboxNotificationsDataSourcePoller::get_published_snapshot() RemoteInboxNotificationsDataSourcePoller::get published snapshot code WC 11.3.0
public function get_published_snapshot(): ?array {
$snapshot = get_transient( self::PUBLISHED_SNAPSHOT_TRANSIENT );
if ( ! is_array( $snapshot ) || ! is_int( $snapshot['fetched_at'] ?? null ) || ! is_array( $snapshot['slugs'] ?? null ) ) {
return null;
}
return array(
'fetched_at' => $snapshot['fetched_at'],
'slugs' => array_map( 'strval', array_values( array_filter( $snapshot['slugs'], 'is_scalar' ) ) ),
);
}