for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Http\Client\Common;
use Psr\Http\Message\RequestInterface;
/**
* Emulates an HTTP Client in an HTTP Async Client.
*
* @author Márk Sági-Kazár <[email protected]>
*/
trait HttpClientEmulator
{
* {@inheritdoc}
* @see HttpClient::sendRequest
public function sendRequest(RequestInterface $request)
$promise = $this->sendAsyncRequest($request);
return $promise->wait();
}
* @see HttpAsyncClient::sendAsyncRequest
abstract public function sendAsyncRequest(RequestInterface $request);