Files
actiewebsitedinges/vendor/mollie/mollie-api-php/src/Contracts/RetryStrategyContract.php
T
2026-10-10 21:32:00 +02:00

36 lines
958 B
PHP

<?php
declare(strict_types=1);
namespace Mollie\Api\Contracts;
use Throwable;
/**
* Defines how retries are performed for retryable network errors.
*/
interface RetryStrategyContract
{
/**
* The maximum number of retries after the initial attempt.
*/
public function maxRetries(): int;
/**
* Whether a given exception should trigger a retry.
*
* Implementations decide which exception classes are retryable.
* Non-retryable exceptions propagate immediately.
*/
public function shouldRetry(Throwable $exception): bool;
/**
* Delay in milliseconds before performing the given retry attempt.
*
* The $attempt parameter starts at 1 for the first retry. Implementations
* may inspect the triggering exception (for example, a 429's Retry-After
* header) to decide the delay.
*/
public function delayBeforeAttemptMs(int $attempt, ?Throwable $exception = null): int;
}