From ef948db322c570787b10d9da734130dd1b0c71b3 Mon Sep 17 00:00:00 2001 From: Masafumi Konishi Date: Thu, 5 Mar 2020 18:30:58 +0900 Subject: [PATCH] =?UTF-8?q?Twitter=20Labs=20=E3=81=AE=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E3=81=AEURL=E3=81=AB=E3=82=82=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=81=95=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/TwitterOAuth.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/TwitterOAuth.php b/src/TwitterOAuth.php index a2739eec..174542b6 100644 --- a/src/TwitterOAuth.php +++ b/src/TwitterOAuth.php @@ -386,7 +386,7 @@ private function http($method, $host, $path, array $parameters, $json) { $this->resetLastResponse(); $this->resetAttemptsNumber(); - $url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path); + $url = $this->getUrl($host, $path); $this->response->setApiPath($path); if (!$json) { $parameters = $this->cleanUpParameters($parameters); @@ -394,6 +394,21 @@ private function http($method, $host, $path, array $parameters, $json) return $this->makeRequests($url, $method, $parameters, $json); } + /** + * Twitter Labs のメソッドに対応させる + * + * @param $host + * @param $path + * @return string + */ + private function getUrl($host, $path) + { + if (strpos($path, 'labs') === 0) { + return $host . '/' . $path; + } + return sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path); + } + /** * * Make requests and retry them (if enabled) in case of Twitter's problems.