NativeClientState.php 1012 B

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