Completed
Pull Request — master (#1)
by Márk
04:37
created

HttpClientEmulator::sendAsyncRequest()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 1
ccs 0
cts 0
cp 0
nc 1
1
<?php
2
3
namespace Http\Client\Common;
4
5
use Psr\Http\Message\RequestInterface;
6
7
/**
8
 * Emulates an HTTP Client in an HTTP Async Client.
9
 *
10
 * @author Márk Sági-Kazár <[email protected]>
11
 */
12
trait HttpClientEmulator
13
{
14
    /**
15
     * {@inheritdoc}
16
     *
17
     * @see HttpClient::sendRequest
18
     */
19 2
    public function sendRequest(RequestInterface $request)
20
    {
21 2
        $promise = $this->sendAsyncRequest($request);
22
23 2
        return $promise->wait();
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     *
29
     * @see HttpAsyncClient::sendAsyncRequest
30
     */
31
    abstract public function sendAsyncRequest(RequestInterface $request);
32
}
33