Skip to content

Commit 8e4b661

Browse files
Removed unreachable plugin client code
1 parent 8151f0f commit 8e4b661

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/PluginClient.php

+2-20
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44

55
namespace Http\Client\Common;
66

7-
use Http\Client\Exception as HttplugException;
87
use Http\Client\HttpAsyncClient;
98
use Http\Client\HttpClient;
10-
use Http\Client\Promise\HttpFulfilledPromise;
11-
use Http\Client\Promise\HttpRejectedPromise;
129
use Psr\Http\Client\ClientInterface;
1310
use Psr\Http\Message\RequestInterface;
1411
use Psr\Http\Message\ResponseInterface;
@@ -24,7 +21,7 @@ final class PluginClient implements HttpClient, HttpAsyncClient
2421
/**
2522
* An HTTP async client.
2623
*
27-
* @var HttpAsyncClient|HttpClient
24+
* @var HttpAsyncClient
2825
*/
2926
private $client;
3027

@@ -71,22 +68,7 @@ public function __construct($client, array $plugins = [], array $options = [])
7168
*/
7269
public function sendRequest(RequestInterface $request): ResponseInterface
7370
{
74-
// If we don't have an http client, use the async call
75-
if (!($this->client instanceof ClientInterface)) {
76-
return $this->sendAsyncRequest($request)->wait();
77-
}
78-
79-
// Else we want to use the synchronous call of the underlying client, and not the async one in the case
80-
// we have both an async and sync call
81-
$pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) {
82-
try {
83-
return new HttpFulfilledPromise($this->client->sendRequest($request));
84-
} catch (HttplugException $exception) {
85-
return new HttpRejectedPromise($exception);
86-
}
87-
});
88-
89-
return $pluginChain($request)->wait();
71+
return $this->sendAsyncRequest($request)->wait();
9072
}
9173

9274
/**

0 commit comments

Comments
 (0)