Skip to content

Commit 51a502c

Browse files
authored
Merge pull request #976 from abraham/url
Switch apiUrl to protected
2 parents 7229769 + 06a1cb3 commit 51a502c

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

src/TwitterOAuth.php

+25-6
Original file line numberDiff line numberDiff line change
@@ -471,18 +471,37 @@ private function http(
471471
) {
472472
$this->resetLastResponse();
473473
$this->resetAttemptsNumber();
474-
$url = sprintf(
474+
$this->response->setApiPath($path);
475+
if (!$json) {
476+
$parameters = $this->cleanUpParameters($parameters);
477+
}
478+
return $this->makeRequests(
479+
$this->apiUrl($host, $path),
480+
$method,
481+
$parameters,
482+
$json,
483+
);
484+
}
485+
486+
/**
487+
* Generate API URL.
488+
*
489+
* Overriding this function is not supported and may cause unintended issues.
490+
*
491+
* @param string $host
492+
* @param string $path
493+
*
494+
* @return string
495+
*/
496+
protected function apiUrl(string $host, string $path)
497+
{
498+
return sprintf(
475499
'%s/%s/%s%s',
476500
$host,
477501
$this->apiVersion,
478502
$path,
479503
$this->extension(),
480504
);
481-
$this->response->setApiPath($path);
482-
if (!$json) {
483-
$parameters = $this->cleanUpParameters($parameters);
484-
}
485-
return $this->makeRequests($url, $method, $parameters, $json);
486505
}
487506

488507
/**

0 commit comments

Comments
 (0)