Yoast\WP\SEO\MyYoast_Client\Application
OAuth_Callback_Handler::consume_outcome
Reads and consumes the pending callback outcome for a user.
Consumed-on-read so the outcome is surfaced exactly once.
Метод класса: OAuth_Callback_Handler{}
Хуков нет.
Возвращает
Callback_Outcome|null. The outcome, or null when none is pending.
Использование
$OAuth_Callback_Handler = new OAuth_Callback_Handler(); $OAuth_Callback_Handler->consume_outcome( $user_id ): ?Callback_Outcome;
- $user_id(int) (обязательный)
- The WordPress user ID.
Код OAuth_Callback_Handler::consume_outcome() OAuth Callback Handler::consume outcome Yoast 28.3
public function consume_outcome( int $user_id ): ?Callback_Outcome {
if ( $user_id <= 0 ) {
return null;
}
try {
$stored = $this->expiring_store->get_for_user( self::OUTCOME_KEY, $user_id );
} catch ( Key_Not_Found_Exception | Corrupted_Value_Exception $e ) {
return null;
}
$this->expiring_store->delete_for_user( self::OUTCOME_KEY, $user_id );
if ( ! \is_array( $stored ) ) {
return null;
}
return Callback_Outcome::from_array( $stored );
}