Automattic\WooCommerce\Internal\PushNotifications\Entities
PushToken::__construct
Creates a new PushToken instance with the given data.
Метод класса: PushToken{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$PushToken = new PushToken(); $PushToken->__construct( $data );
- $data(массив)
- Optional array with keys: id, user_id, token, device_uuid, platform, origin.
По умолчанию:array()
Список изменений
| С версии 10.6.0 | Введена. |
Код PushToken::__construct() PushToken:: construct WC 11.3.0
public function __construct( array $data = array() ) {
if ( array_key_exists( 'id', $data ) ) {
$this->set_id( (int) $data['id'] );
}
if ( array_key_exists( 'user_id', $data ) ) {
$this->set_user_id( (int) $data['user_id'] );
}
if ( array_key_exists( 'token', $data ) ) {
$this->set_token( (string) $data['token'] );
}
if ( array_key_exists( 'device_uuid', $data ) ) {
$this->set_device_uuid( (string) $data['device_uuid'] );
}
if ( array_key_exists( 'platform', $data ) ) {
$this->set_platform( (string) $data['platform'] );
}
if ( array_key_exists( 'origin', $data ) ) {
$this->set_origin( (string) $data['origin'] );
}
if ( array_key_exists( 'device_locale', $data ) ) {
$this->set_device_locale( (string) $data['device_locale'] );
}
if ( array_key_exists( 'metadata', $data ) ) {
$this->set_metadata( (array) $data['metadata'] );
}
if ( array_key_exists( 'created_at_gmt', $data ) ) {
$this->set_created_at_gmt( null === $data['created_at_gmt'] ? null : (string) $data['created_at_gmt'] );
}
if ( array_key_exists( 'last_confirmed_at_gmt', $data ) ) {
$this->set_last_confirmed_at_gmt( null === $data['last_confirmed_at_gmt'] ? null : (string) $data['last_confirmed_at_gmt'] );
}
if ( array_key_exists( 'last_sent_at_gmt', $data ) ) {
$this->set_last_sent_at_gmt( null === $data['last_sent_at_gmt'] ? null : (string) $data['last_sent_at_gmt'] );
}
}