Automattic\WooCommerce\StoreApi
SessionHandler::init_session_from_token
Process the token header to load the correct session.
Verifies the signature here rather than trusting the caller that selected this handler.
Метод класса: SessionHandler{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->init_session_from_token();
Код SessionHandler::init_session_from_token() SessionHandler::init session from token WC 11.1.2
protected function init_session_from_token() {
if ( ! CartTokenUtils::validate_cart_token( $this->token ) ) {
$this->_customer_id = $this->generate_customer_id();
$this->session_expiration = CartTokenUtils::get_cart_token_expiration();
$this->_data = array();
return;
}
$payload = CartTokenUtils::get_cart_token_payload( $this->token );
$this->_customer_id = $payload['user_id'];
$this->session_expiration = $payload['exp'];
$this->_data = (array) $this->get_session( $this->get_customer_id(), array() );
}