| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <[email protected]> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | |
| 12 | namespace Symfony\Component\HttpClient\Retry; |
| 13 | |
| 14 | use Symfony\Component\HttpClient\Response\AsyncContext; |
| 15 | use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; |
| 16 | |
| 17 | /** |
| 18 | * @author Jérémy Derussé <[email protected]om> |
| 19 | * @author Nicolas Grekas <[email protected]> |
| 20 | */ |
| 21 | interface RetryStrategyInterface |
| 22 | { |
| 23 | /** |
| 24 | * Returns whether the request should be retried. |
| 25 | * |
| 26 | * @param ?string $responseContent Null is passed when the body did not arrive yet |
| 27 | * |
| 28 | * @return bool|null Returns null to signal that the body is required to take a decision |
| 29 | */ |
| 30 | public function shouldRetry(AsyncContext $context, ?string $responseContent, ?TransportExceptionInterface $exception): ?bool; |
| 31 | |
| 32 | /** |
| 33 | * Returns the time to wait in milliseconds. |
| 34 | */ |
| 35 | public function getDelay(AsyncContext $context, ?string $responseContent, ?TransportExceptionInterface $exception): int; |
| 36 | } |