WC_Payment_Token::__construct
Initialize a payment token.
These fields are accepted by all payment tokens: is_default - boolean Optional - Indicates this is the default payment token for a user token - string Required - The actual token to store gateway_id - string Required - Identifier for the gateway this token is associated with user_id - int Optional - ID for the user this token is associated with. 0 if this token is not associated with a user
Метод класса: WC_Payment_Token{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WC_Payment_Token = new WC_Payment_Token(); $WC_Payment_Token->__construct( $token );
- $token(разное)
- Token.
По умолчанию:''
Список изменений
| С версии 2.6.0 | Введена. |
Код WC_Payment_Token::__construct() WC Payment Token:: construct WC 10.9.1
public function __construct( $token = '' ) {
parent::__construct( $token );
if ( is_numeric( $token ) ) {
$this->set_id( $token );
} elseif ( is_object( $token ) ) {
$token_id = $token->get_id();
if ( ! empty( $token_id ) ) {
$this->set_id( $token->get_id() );
}
} else {
$this->set_object_read( true );
}
$this->data_store = WC_Data_Store::load( 'payment-token' );
if ( $this->get_id() > 0 ) {
$this->data_store->read( $this );
}
}