Yoast\WP\SEO\MyYoast_Client\Application
Authorization_Code_Handler::get_flow_state
Retrieves and validates the stored flow state for a user.
Метод класса: Authorization_Code_Handler{}
Хуков нет.
Возвращает
Auth_Flow_State. The stored flow state.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_flow_state( $user_id ): Auth_Flow_State;
- $user_id(int) (обязательный)
- The WordPress user ID.
Код Authorization_Code_Handler::get_flow_state() Authorization Code Handler::get flow state Yoast 28.9
private function get_flow_state( int $user_id ): Auth_Flow_State {
try {
$stored = $this->expiring_store->get_for_user( self::CURRENT_AUTH_FLOW_STATE_KEY, $user_id );
} catch ( Key_Not_Found_Exception | Corrupted_Value_Exception $e ) {
$this->logger->warning( 'No pending authorization flow state found for user {user_id}.', [ 'user_id' => $user_id ] );
throw new Token_Request_Failed_Exception( 'invalid_request', 'No pending authorization found for this user.' );
}
if ( ! \is_array( $stored ) ) {
$this->logger->warning( 'Stored authorization flow state is not an array for user {user_id}.', [ 'user_id' => $user_id ] );
throw new Token_Request_Failed_Exception( 'invalid_request', 'No pending authorization found for this user.' );
}
try {
return Auth_Flow_State::from_array( $stored );
} catch ( InvalidArgumentException $e ) {
$this->logger->error(
'Stored authorization state is invalid for user {user_id}: {error}',
[
'user_id' => $user_id,
'error' => $e->getMessage(),
],
);
throw new Token_Request_Failed_Exception( 'invalid_request', 'Stored authorization state is invalid.' );
}
}