Skip to content

Commit ffc4f7b

Browse files
authored
Merge branch 'master' into Nyholm-patch-2
2 parents 3ad95c6 + 9bf1092 commit ffc4f7b

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

src/Client.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@
1313
use Psr\Http\Message\RequestInterface;
1414
use function Amp\call;
1515

16-
class Client implements HttpClient {
16+
class Client implements HttpClient
17+
{
1718
private $client;
1819
private $responseFactory;
1920
private $streamFactory;
2021

21-
public function __construct(Artax\Client $client = null, ResponseFactory $responseFactory = null, StreamFactory $streamFactory = null) {
22-
$this->client = $client ?? new Artax\DefaultClient;
22+
public function __construct(Artax\Client $client = null, ResponseFactory $responseFactory = null, StreamFactory $streamFactory = null)
23+
{
24+
$this->client = $client ?? new Artax\DefaultClient();
2325
$this->responseFactory = $responseFactory ?? MessageFactoryDiscovery::find();
2426
$this->streamFactory = $streamFactory ?? StreamFactoryDiscovery::find();
2527
}
2628

27-
/** @inheritdoc */
28-
public function sendRequest(RequestInterface $request) {
29+
/** {@inheritdoc} */
30+
public function sendRequest(RequestInterface $request)
31+
{
2932
return Promise\wait(call(function () use ($request) {
3033
/** @var Artax\Request $req */
3134
$req = new Artax\Request($request->getUri(), $request->getMethod());
@@ -60,4 +63,4 @@ public function sendRequest(RequestInterface $request) {
6063
);
6164
}));
6265
}
63-
}
66+
}

tests/ClientTest.php

+10-7
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
use Http\Client\Tests\HttpClientTest;
88
use Http\Adapter\Artax\Client;
99

10-
class ClientTest extends HttpClientTest {
10+
class ClientTest extends HttpClientTest
11+
{
1112
/** @return HttpClient */
12-
protected function createHttpAdapter() {
13-
$client = new Artax\DefaultClient;
13+
protected function createHttpAdapter()
14+
{
15+
$client = new Artax\DefaultClient();
1416
$client->setOption(Artax\Client::OP_TRANSFER_TIMEOUT, 1000);
1517

1618
return new Client($client);
@@ -20,11 +22,12 @@ protected function createHttpAdapter() {
2022
* @dataProvider requestProvider
2123
* @group integration
2224
*/
23-
public function testSendRequest($method, $uri, array $headers, $body) {
24-
if ($method === "TRACE") {
25-
$this->markTestSkipped("Currently skipped, because Artax refuses to send bodies for TRACE requests");
25+
public function testSendRequest($method, $uri, array $headers, $body)
26+
{
27+
if ($method === 'TRACE') {
28+
$this->markTestSkipped('Currently skipped, because Artax refuses to send bodies for TRACE requests');
2629
}
2730

2831
parent::testSendRequest($method, $uri, $headers, $body);
2932
}
30-
}
33+
}

0 commit comments

Comments
 (0)