PHP 8.3.31
Preview: RequestFactory.php Size: 945 B
/home/getspomw/royalsquad.us/vendor/maxmind/web-service-common/src/WebService/Http/RequestFactory.php

<?php

declare(strict_types=1);

namespace MaxMind\WebService\Http;

/**
 * Class RequestFactory.
 *
 * @internal
 */
class RequestFactory
{
    /**
     * Keep the cURL resource here, so that if there are multiple API requests
     * done the connection is kept alive, SSL resumption can be used
     * etcetera.
     *
     * @var \CurlHandle|null
     */
    private $ch;

    public function __destruct()
    {
        if (!empty($this->ch)) {
            curl_close($this->ch);
        }
    }

    /**
     * @return \CurlHandle
     */
    private function getCurlHandle()
    {
        if (empty($this->ch)) {
            $this->ch = curl_init();
        }

        return $this->ch;
    }

    /**
     * @param array<string, mixed> $options
     */
    public function request(string $url, array $options): Request
    {
        $options['curlHandle'] = $this->getCurlHandle();

        return new CurlRequest($url, $options);
    }
}

Directory Contents

Dirs: 0 × Files: 4

Name Size Perms Modified Actions
3.69 KB lrw-rw-rw- 2024-11-14 09:44:52
Edit Download
1.07 KB lrw-r--r-- 2026-04-25 10:51:51
Edit Download
490 B lrw-rw-rw- 2024-11-14 09:44:52
Edit Download
945 B lrw-rw-rw- 2024-11-14 09:44:52
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).