Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 3819d87

Browse files
authored
Merge pull request #147 from ramunasd/fix_double_json_decode
Remove redundant json_decode() on result set, minor improvements
2 parents 3e90a37 + d43284c commit 3819d87

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/HttpDriver/Session.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
use Http\Client\Common\Plugin\ErrorPlugin;
2323
use Http\Client\Common\PluginClient;
2424
use Http\Client\Exception\HttpException;
25-
use Http\Client\Exception\RequestException;
2625
use Http\Client\HttpClient;
27-
use Http\Discovery\MessageFactoryDiscovery;
2826
use Http\Message\RequestFactory;
2927
use Psr\Http\Message\RequestInterface;
3028

@@ -63,7 +61,7 @@ class Session implements SessionInterface
6361
/**
6462
* @param string $uri
6563
* @param GuzzleClient|HttpClient $httpClient
66-
* @param BaseConfiguration $config
64+
* @param ConfigInterface $config
6765
*/
6866
public function __construct($uri, $httpClient, ConfigInterface $config)
6967
{
@@ -154,9 +152,8 @@ public function flush(Pipeline $pipeline)
154152

155153
throw $exception;
156154
}
157-
$results = $this->responseFormatter->format(json_decode($response->getBody(), true), $pipeline->statements());
158155

159-
return $results;
156+
return $this->responseFormatter->format($data, $pipeline->statements());
160157
} catch (HttpException $e) {
161158
$body = json_decode($e->getResponse()->getBody(), true);
162159
if (!isset($body['code'])) {
@@ -287,7 +284,7 @@ public function pushToTransaction($transactionId, array $statementsStack)
287284
throw $exception;
288285
}
289286

290-
return $this->responseFormatter->format(json_decode($response->getBody(), true), $statementsStack);
287+
return $this->responseFormatter->format($data, $statementsStack);
291288
} catch (HttpException $e) {
292289
$body = json_decode($e->getResponse()->getBody(), true);
293290
if (!isset($body['code'])) {

0 commit comments

Comments
 (0)