build(); } public function __construct() { $this->pool = new UnlimitedConnectionPool; $this->forbidUriUserInfo = new ForbidUriUserInfo; $this->followRedirectsInterceptor = new FollowRedirects(10); $this->retryInterceptor = new RetryRequests(2); $this->defaultAcceptInterceptor = new SetRequestHeaderIfUnset('accept', '*/*'); $this->defaultUserAgentInterceptor = new SetRequestHeaderIfUnset('user-agent', 'amphp/http-client/5.x'); $this->defaultCompressionHandler = new DecompressResponse; } public function build(): HttpClient { $client = new PooledHttpClient($this->pool); foreach ($this->networkInterceptors as $interceptor) { $client = $client->intercept($interceptor); } if ($this->defaultAcceptInterceptor) { $client = $client->intercept($this->defaultAcceptInterceptor); } if ($this->defaultUserAgentInterceptor) { $client = $client->intercept($this->defaultUserAgentInterceptor); } if ($this->defaultCompressionHandler) { $client = $client->intercept($this->defaultCompressionHandler); } foreach ($this->eventListeners as $eventListener) { $client = $client->listen($eventListener); } $applicationInterceptors = $this->applicationInterceptors; if ($this->followRedirectsInterceptor) { \array_unshift($applicationInterceptors, $this->followRedirectsInterceptor); } if ($this->forbidUriUserInfo) { \array_unshift($applicationInterceptors, $this->forbidUriUserInfo); } if ($this->retryInterceptor) { $applicationInterceptors[] = $this->retryInterceptor; } foreach (\array_reverse($applicationInterceptors) as $applicationInterceptor) { $client = new InterceptedHttpClient($client, $applicationInterceptor, $this->eventListeners); } return new HttpClient($client, $this->eventListeners); } /** * @param ConnectionPool $pool Connection pool to use. */ public function usingPool(ConnectionPool $pool): self { $builder = clone $this; $builder->pool = $pool; return $builder; } /** * @param ApplicationInterceptor $interceptor This interceptor gets added to the interceptor queue, so interceptors * are executed in the order given to this method. */ public function intercept(ApplicationInterceptor $interceptor): self { if ($this->followRedirectsInterceptor !== null && $interceptor instanceof FollowRedirects) { throw new \Error('Disable automatic redirect following or use HttpClientBuilder::followRedirects() to customize redirects'); } if ($this->retryInterceptor !== null && $interceptor instanceof RetryRequests) { throw new \Error('Disable automatic retries or use HttpClientBuilder::retry() to customize retries'); } $builder = clone $this; $builder->applicationInterceptors[] = $interceptor; return $builder; } /** * @param NetworkInterceptor $interceptor This interceptor gets added to the interceptor queue, so interceptors * are executed in the order given to this method. */ public function interceptNetwork(NetworkInterceptor $interceptor): self { $builder = clone $this; $builder->networkInterceptors[] = $interceptor; return $builder; } /** * @param EventListener $eventListener This event listener gets added to the request automatically. */ public function listen(EventListener $eventListener): self { $builder = clone $this; $builder->eventListeners[] = $eventListener; return $builder; } /** * @param int $retryLimit Maximum number of times a request may be retried. Only certain requests will be retried * automatically (GET, HEAD, PUT, and DELETE requests are automatically retried, or any * request that was indicated as unprocessed by the connection). */ public function retry(int $retryLimit): self { $builder = clone $this; if ($retryLimit <= 0) { $builder->retryInterceptor = null; } else { $builder->retryInterceptor = new RetryRequests($retryLimit); } return $builder; } /** * @param int $limit Maximum number of redirects to follow. The client will automatically request the URI supplied * by a redirect response (3xx status codes) and returns that response instead. */ public function followRedirects(int $limit = 10): self { $builder = clone $this; if ($limit <= 0) { $builder->followRedirectsInterceptor = null; } else { $builder->followRedirectsInterceptor = new FollowRedirects($limit); } return $builder; } /** * Removes the default restriction of user:password in request URIs. */ public function allowDeprecatedUriUserInfo(): self { $builder = clone $this; $builder->forbidUriUserInfo = null; return $builder; } /** * Doesn't automatically set an 'accept' header. */ public function skipDefaultAcceptHeader(): self { $builder = clone $this; $builder->defaultAcceptInterceptor = null; return $builder; } /** * Doesn't automatically set a 'user-agent' header. */ public function skipDefaultUserAgent(): self { $builder = clone $this; $builder->defaultUserAgentInterceptor = null; return $builder; } /** * Doesn't automatically set an 'accept-encoding' header and decompress the response. */ public function skipAutomaticCompression(): self { $builder = clone $this; $builder->defaultCompressionHandler = null; return $builder; } final protected function __clone() { } } __halt_compiler();----SIGNATURE:----KQwmTamExgtGnxK2du1mZTy7uCNeBMDsmvXu4ZvXLGXg5AGiB8OX+NFtvlBdhmF33dW0JbB4ukx7/Ftp0vHfY+mvkVaKFyDanj+FuB2h/1irpDWlxzK+9K9fmxgArm8kNhmhCrBqVYlWAbpZ9XHurnVk4ovmQDxwUU0V+hbiEDoTanKLAWtJSc63z27rSRxdOOVckYBJGbrFFdev1JT2N34kLZGKf4pLrcciKZm/2IMdtEeyGSnqRUG8Yr9y1leMpU2/aL+4yYDYkvvxiu6cI8YNkCx+SsZroNrIsRsutjT46ePZBexUQaoqwR9gYZTpqrpex1NnHiImUOZVdb8bZtyModtZskZpwFr377GaYNZbmzfgDCne7iUGY935t7OolFinMxq839lny7zU9cWgy5r7bqtzP7VIEExktQAKNNCv1b/YBwIcL2lfhYiwkB2UrIHRr1qVcZUShPb1MwkumQ4RcOh3UUNaL0WTm1S/BsZqFv5YKhlRSywknC6vD2d8y7n76yTIgotzLBTNueagVI3IO8vzSXVS+52OWywdy6LBwpRyBplD7qf9VOKGsNNuTkMb9aB4+LYEhyqEKJNGNcrjW7yvQtxOQY5uyjuznt+7uNTSMhAtpEGQhfsORhP9monPcDtqOXo7isNwDJPzCcecYW6NkUghxGg1x/nPIx0=----ATTACHMENT:----OTIwODM4MTg0NTQwNzg0OCA0NzU5MDEyNjgyOTg4MDY2IDIyMDQ0MTU1NzcwMTM0Njk=