Yoast\WP\SEO\MyYoast_Client\Application\Exceptions

Rate_Limited_Exception::parse_retry_after │ public static │ Yoast 1.0

Parses an HTTP Retry-After value into seconds-until-retry.

Accepts either the delta-seconds form ("120") or the HTTP-date form ("Wed, 27 May 2026 14:30:00 GMT") per RFC 9110 §10.2.3.

phpcs:disable SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint -- Raw header value is heterogeneous (string, numeric, array, or null).

Метод класса: Rate_Limited_Exception{}

Хуков нет.

Возвращает

int|null. Seconds until retry (clamped to >= 0), or null when unparseable.

phpcs:enable SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint

Использование

$result = Rate_Limited_Exception::parse_retry_after( $retry_after ): ?int;
$retry_after(разное) (обязательный)
The raw header value (string, numeric, array, or null).

Код Rate_Limited_Exception::parse_retry_after() Yoast 28.9

public static function parse_retry_after( $retry_after ): ?int {
	if ( \is_array( $retry_after ) ) {
		$retry_after = \reset( $retry_after );
	}

	if ( $retry_after === null || $retry_after === '' ) {
		return null;
	}

	if ( \is_numeric( $retry_after ) ) {
		return \max( 0, (int) $retry_after );
	}

	$timestamp = \strtotime( (string) $retry_after );
	if ( $timestamp === false ) {
		return null;
	}

	return \max( 0, ( $timestamp - \time() ) );
}