NativeClientState.php 960 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpClient\Internal;
  11. /**
  12. * Internal representation of the native client's state.
  13. *
  14. * @author Alexander M. Turek <me@derrabus.de>
  15. *
  16. * @internal
  17. */
  18. final class NativeClientState extends ClientState
  19. {
  20. public int $id;
  21. public int $maxHostConnections = \PHP_INT_MAX;
  22. public int $responseCount = 0;
  23. /** @var string[] */
  24. public array $dnsCache = [];
  25. public bool $sleep = false;
  26. /** @var int[] */
  27. public array $hosts = [];
  28. public function __construct()
  29. {
  30. $this->id = random_int(\PHP_INT_MIN, \PHP_INT_MAX);
  31. }
  32. public function reset()
  33. {
  34. $this->responseCount = 0;
  35. $this->dnsCache = [];
  36. $this->hosts = [];
  37. }
  38. }