From ac63879aaceda32d32fe55366a3b3a55cf8d1018 Mon Sep 17 00:00:00 2001 From: Dayane Moraes Date: Tue, 27 Oct 2020 08:21:30 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20da=20classe=20de=20request?= =?UTF-8?q?=20do=20Guzzle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/CaseConverter.php | 2 -- lib/Client.php | 18 +++++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/CaseConverter.php b/lib/CaseConverter.php index e233520..adad2c7 100644 --- a/lib/CaseConverter.php +++ b/lib/CaseConverter.php @@ -4,8 +4,6 @@ trait CaseConverter { - use CaseConverter; - /** * @param string $sentence * @return string diff --git a/lib/Client.php b/lib/Client.php index bc73437..f23b944 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -80,15 +80,6 @@ public function send(RequestInterface $apiRequest) */ private function buildRequest($apiRequest) { - if (class_exists('\\GuzzleHttp\\Psr7\\Request')) { - return new \GuzzleHttp\Psr7\Request( - $apiRequest->getMethod(), - $apiRequest->getPath(), - ['Content-Type' => 'application/json'], - json_encode($this->buildBody($apiRequest)) - ); - } - if (class_exists('\\GuzzleHttp\\Message\\Request') && method_exists($this->client, 'createRequest') ) { @@ -103,6 +94,15 @@ private function buildRequest($apiRequest) ); } + if (class_exists('\\GuzzleHttp\\Psr7\\Request')) { + return new \GuzzleHttp\Psr7\Request( + $apiRequest->getMethod(), + $apiRequest->getPath(), + ['Content-Type' => 'application/json'], + json_encode($this->buildBody($apiRequest)) + ); + } + throw new \Exception("Can't build request"); }