| [ Index ] |
PHP Cross Reference of YOURLS |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare(strict_types=1); 4 5 namespace MaxMind\WebService\Http; 6 7 /** 8 * Class RequestFactory. 9 * 10 * @internal 11 */ 12 class RequestFactory 13 { 14 /** 15 * Keep the cURL resource here, so that if there are multiple API requests 16 * done the connection is kept alive, SSL resumption can be used 17 * etcetera. 18 */ 19 private ?\CurlHandle $ch = null; 20 21 private function getCurlHandle(): \CurlHandle 22 { 23 if ($this->ch === null) { 24 $ch = curl_init(); 25 if ($ch === false) { 26 throw new \RuntimeException('Unable to initialize cURL handle'); 27 } 28 $this->ch = $ch; 29 } 30 31 return $this->ch; 32 } 33 34 /** 35 * @param array<string, mixed> $options 36 */ 37 public function request(string $url, array $options): Request 38 { 39 $options['curlHandle'] = $this->getCurlHandle(); 40 41 // @phpstan-ignore argument.type (options array is built dynamically by Client) 42 return new CurlRequest($url, $options); 43 } 44 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Jul 11 05:10:54 2026 | Cross-referenced by PHPXref 0.7.1 |