Skip to content

Commit 4dd0463

Browse files
authored
Make httpClient() a public, static method (#1810)
* Make `httpClient()` a public, static method * Make `streamingHttpClient()` a public, static method
1 parent 3fb2225 commit 4dd0463

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/ApiRequestor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ private function _prepareRequest($method, $url, $params, $headers, $apiMode)
436436
// X-Stripe-Client-User-Agent header via the optional getUserAgentInfo()
437437
// method
438438
$clientUAInfo = null;
439-
if (\method_exists($this->httpClient(), 'getUserAgentInfo')) {
440-
$clientUAInfo = $this->httpClient()->getUserAgentInfo();
439+
if (\method_exists(self::httpClient(), 'getUserAgentInfo')) {
440+
$clientUAInfo = self::httpClient()->getUserAgentInfo();
441441
}
442442

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

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

521-
list($rbody, $rcode, $rheaders) = $this->httpClient()->request(
521+
list($rbody, $rcode, $rheaders) = self::httpClient()->request(
522522
$method,
523523
$absUrl,
524524
$rawHeaders,
@@ -562,7 +562,7 @@ private function _requestRawStreaming($method, $url, $params, $headers, $apiMode
562562

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

565-
list($rbody, $rcode, $rheaders) = $this->streamingHttpClient()->requestStream(
565+
list($rbody, $rcode, $rheaders) = self::streamingHttpClient()->requestStream(
566566
$method,
567567
$absUrl,
568568
$rawHeaders,
@@ -673,7 +673,7 @@ public static function resetTelemetry()
673673
/**
674674
* @return HttpClient\ClientInterface
675675
*/
676-
private function httpClient()
676+
public static function httpClient()
677677
{
678678
if (!self::$_httpClient) {
679679
self::$_httpClient = HttpClient\CurlClient::instance();
@@ -685,7 +685,7 @@ private function httpClient()
685685
/**
686686
* @return HttpClient\StreamingClientInterface
687687
*/
688-
private function streamingHttpClient()
688+
public static function streamingHttpClient()
689689
{
690690
if (!self::$_streamingHttpClient) {
691691
self::$_streamingHttpClient = HttpClient\CurlClient::instance();

0 commit comments

Comments
 (0)