Automattic\WooCommerce\Internal\CustomerEmailVerification

EmailVerificationService::seconds_since_last_key │ public │ WC 11.0.0

Return the number of seconds elapsed since the last verification key was issued, or null if none exists.

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

Хуков нет.

Возвращает

int|null. Seconds since the last key was created, or null when none is stored.

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

$EmailVerificationService = new EmailVerificationService();
$EmailVerificationService->seconds_since_last_key( $user_id ): ?int;
$user_id(int) (обязательный)
WordPress user ID.

Список изменений

С версии 11.0.0 Введена.

Код EmailVerificationService::seconds_since_last_key() WC 11.2.2

public function seconds_since_last_key( int $user_id ): ?int {
	$parsed = $this->parse_stored_key( $user_id );

	if ( null === $parsed ) {
		return null;
	}

	// Clamp to zero so a future timestamp (clock skew, migrations) can't report negative
	// elapsed time and wedge the resend rate-limit / "recently sent" notice logic.
	return max( 0, time() - $parsed[0] );
}