Automattic\WooCommerce\Internal\PushNotifications\DataStores
PushTokensDataStore::build_meta_array_from_token
Returns an associative array of post meta as key => value pairs, built using push token properties.
Method of the class: PushTokensDataStore{}
No Hooks.
Returns
Array.
Usage
// private - for code of main (parent) class only $result = $this->build_meta_array_from_token( $push_token );
- $push_token(PushToken) (required)
- An instance of PushToken.
Changelog
| Since 10.5.0 | Introduced. |
PushTokensDataStore::build_meta_array_from_token() PushTokensDataStore::build meta array from token code WC 10.8.1
private function build_meta_array_from_token( PushToken $push_token ) {
return array_filter(
array(
'platform' => $push_token->get_platform(),
'token' => $push_token->get_token(),
'device_uuid' => $push_token->get_device_uuid(),
'origin' => $push_token->get_origin(),
'device_locale' => $push_token->get_device_locale(),
'metadata' => $push_token->get_metadata(),
),
fn ( $value ) => null !== $value && '' !== $value
);
}