Skip to content

Commit

Permalink
Make httpClient() a public, static method (#1810)
Browse files Browse the repository at this point in the history
* Make `httpClient()` a public, static method

* Make `streamingHttpClient()` a public, static method
  • Loading branch information
dejagersh authored Jan 29, 2025
1 parent 3fb2225 commit 4dd0463
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/ApiRequestor.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ private function _prepareRequest($method, $url, $params, $headers, $apiMode)
// X-Stripe-Client-User-Agent header via the optional getUserAgentInfo()
// method
$clientUAInfo = null;
if (\method_exists($this->httpClient(), 'getUserAgentInfo')) {
$clientUAInfo = $this->httpClient()->getUserAgentInfo();
if (\method_exists(self::httpClient(), 'getUserAgentInfo')) {
$clientUAInfo = self::httpClient()->getUserAgentInfo();
}

if ($params && \is_array($params)) {
Expand Down Expand Up @@ -518,7 +518,7 @@ private function _requestRaw($method, $url, $params, $headers, $apiMode, $usage)

$requestStartMs = Util\Util::currentTimeMillis();

list($rbody, $rcode, $rheaders) = $this->httpClient()->request(
list($rbody, $rcode, $rheaders) = self::httpClient()->request(
$method,
$absUrl,
$rawHeaders,
Expand Down Expand Up @@ -562,7 +562,7 @@ private function _requestRawStreaming($method, $url, $params, $headers, $apiMode

$requestStartMs = Util\Util::currentTimeMillis();

list($rbody, $rcode, $rheaders) = $this->streamingHttpClient()->requestStream(
list($rbody, $rcode, $rheaders) = self::streamingHttpClient()->requestStream(
$method,
$absUrl,
$rawHeaders,
Expand Down Expand Up @@ -673,7 +673,7 @@ public static function resetTelemetry()
/**
* @return HttpClient\ClientInterface
*/
private function httpClient()
public static function httpClient()
{
if (!self::$_httpClient) {
self::$_httpClient = HttpClient\CurlClient::instance();
Expand All @@ -685,7 +685,7 @@ private function httpClient()
/**
* @return HttpClient\StreamingClientInterface
*/
private function streamingHttpClient()
public static function streamingHttpClient()
{
if (!self::$_streamingHttpClient) {
self::$_streamingHttpClient = HttpClient\CurlClient::instance();
Expand Down

0 comments on commit 4dd0463

Please sign in to comment.