NativeClientState.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. /**
  21. * @var int
  22. */
  23. public $id;
  24. /**
  25. * @var int
  26. */
  27. public $maxHostConnections = \PHP_INT_MAX;
  28. /**
  29. * @var int
  30. */
  31. public $responseCount = 0;
  32. /** @var string[] */
  33. public $dnsCache = [];
  34. /**
  35. * @var bool
  36. */
  37. public $sleep = false;
  38. /** @var int[] */
  39. public $hosts = [];
  40. public function __construct()
  41. {
  42. $this->id = random_int(\PHP_INT_MIN, \PHP_INT_MAX);
  43. }
  44. public function reset()
  45. {
  46. $this->responseCount = 0;
  47. $this->dnsCache = [];
  48. $this->hosts = [];
  49. }
  50. }