Skip to content

Commit 9f6d02c

Browse files
committed
Apply the base configuration
1 parent 94c98c6 commit 9f6d02c

36 files changed

+235
-265
lines changed

spec/BatchClientSpec.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99

1010
class BatchClientSpec extends ObjectBehavior
1111
{
12-
function let(HttpClient $client)
12+
public function let(HttpClient $client)
1313
{
1414
$this->beAnInstanceOf('Http\Client\Common\BatchClient', [$client]);
1515
}
1616

17-
function it_send_multiple_request_using_send_request(HttpClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response1, ResponseInterface $response2)
17+
public function it_send_multiple_request_using_send_request(HttpClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response1, ResponseInterface $response2)
1818
{
1919
$client->sendRequest($request1)->willReturn($response1);
2020
$client->sendRequest($request2)->willReturn($response2);
2121

2222
$this->sendRequests([$request1, $request2])->shouldReturnAnInstanceOf('Http\Client\Common\BatchResult');
2323
}
2424

25-
function it_throw_batch_exception_if_one_or_more_request_failed(HttpClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response)
25+
public function it_throw_batch_exception_if_one_or_more_request_failed(HttpClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response)
2626
{
2727
$client->sendRequest($request1)->willReturn($response);
2828
$client->sendRequest($request2)->willThrow('Http\Client\Exception\HttpException');

spec/BatchResultSpec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
class BatchResultSpec extends ObjectBehavior
1111
{
12-
function it_is_initializable()
12+
public function it_is_initializable()
1313
{
1414
$this->beAnInstanceOf('Http\Client\Common\BatchResult');
1515
}
1616

17-
function it_is_immutable(RequestInterface $request, ResponseInterface $response)
17+
public function it_is_immutable(RequestInterface $request, ResponseInterface $response)
1818
{
1919
$new = $this->addResponse($request, $response);
2020

@@ -23,7 +23,7 @@ function it_is_immutable(RequestInterface $request, ResponseInterface $response)
2323
$new->getResponses()->shouldReturn([$response]);
2424
}
2525

26-
function it_has_a_responses(RequestInterface $request, ResponseInterface $response)
26+
public function it_has_a_responses(RequestInterface $request, ResponseInterface $response)
2727
{
2828
$new = $this->addResponse($request, $response);
2929

@@ -33,7 +33,7 @@ function it_has_a_responses(RequestInterface $request, ResponseInterface $respon
3333
$new->getResponses()->shouldReturn([$response]);
3434
}
3535

36-
function it_has_a_response_for_a_request(RequestInterface $request, ResponseInterface $response)
36+
public function it_has_a_response_for_a_request(RequestInterface $request, ResponseInterface $response)
3737
{
3838
$new = $this->addResponse($request, $response);
3939

@@ -43,7 +43,7 @@ function it_has_a_response_for_a_request(RequestInterface $request, ResponseInte
4343
$new->isSuccessful($request)->shouldReturn(true);
4444
}
4545

46-
function it_keeps_exception_after_add_request(RequestInterface $request1, Exception $exception, RequestInterface $request2, ResponseInterface $response)
46+
public function it_keeps_exception_after_add_request(RequestInterface $request1, Exception $exception, RequestInterface $request2, ResponseInterface $response)
4747
{
4848
$new = $this->addException($request1, $exception);
4949
$new = $new->addResponse($request2, $response);

spec/EmulatedHttpAsyncClientSpec.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@
99

1010
class EmulatedHttpAsyncClientSpec extends ObjectBehavior
1111
{
12-
function let(HttpClient $httpClient)
12+
public function let(HttpClient $httpClient)
1313
{
1414
$this->beConstructedWith($httpClient);
1515
}
1616

17-
function it_is_initializable()
17+
public function it_is_initializable()
1818
{
1919
$this->shouldHaveType('Http\Client\Common\EmulatedHttpAsyncClient');
2020
}
2121

22-
function it_is_an_http_client()
22+
public function it_is_an_http_client()
2323
{
2424
$this->shouldImplement('Http\Client\HttpClient');
2525
}
2626

27-
function it_is_an_async_http_client()
27+
public function it_is_an_async_http_client()
2828
{
2929
$this->shouldImplement('Http\Client\HttpAsyncClient');
3030
}
3131

32-
function it_emulates_a_successful_request(
32+
public function it_emulates_a_successful_request(
3333
HttpClient $httpClient,
3434
RequestInterface $request,
3535
ResponseInterface $response
@@ -39,14 +39,14 @@ function it_emulates_a_successful_request(
3939
$this->sendAsyncRequest($request)->shouldReturnAnInstanceOf('Http\Client\Promise\HttpFulfilledPromise');
4040
}
4141

42-
function it_emulates_a_failed_request(HttpClient $httpClient, RequestInterface $request)
42+
public function it_emulates_a_failed_request(HttpClient $httpClient, RequestInterface $request)
4343
{
4444
$httpClient->sendRequest($request)->willThrow('Http\Client\Exception\TransferException');
4545

4646
$this->sendAsyncRequest($request)->shouldReturnAnInstanceOf('Http\Client\Promise\HttpRejectedPromise');
4747
}
4848

49-
function it_decorates_the_underlying_client(
49+
public function it_decorates_the_underlying_client(
5050
HttpClient $httpClient,
5151
RequestInterface $request,
5252
ResponseInterface $response

spec/EmulatedHttpClientSpec.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace spec\Http\Client\Common;
44

55
use Http\Client\Exception\TransferException;
6-
use Http\Client\HttpClient;
76
use Http\Client\HttpAsyncClient;
87
use Http\Promise\Promise;
98
use Psr\Http\Message\RequestInterface;
@@ -12,27 +11,27 @@
1211

1312
class EmulatedHttpClientSpec extends ObjectBehavior
1413
{
15-
function let(HttpAsyncClient $httpAsyncClient)
14+
public function let(HttpAsyncClient $httpAsyncClient)
1615
{
1716
$this->beConstructedWith($httpAsyncClient);
1817
}
1918

20-
function it_is_initializable()
19+
public function it_is_initializable()
2120
{
2221
$this->shouldHaveType('Http\Client\Common\EmulatedHttpClient');
2322
}
2423

25-
function it_is_an_http_client()
24+
public function it_is_an_http_client()
2625
{
2726
$this->shouldImplement('Http\Client\HttpClient');
2827
}
2928

30-
function it_is_an_async_http_client()
29+
public function it_is_an_async_http_client()
3130
{
3231
$this->shouldImplement('Http\Client\HttpAsyncClient');
3332
}
3433

35-
function it_emulates_a_successful_request(
34+
public function it_emulates_a_successful_request(
3635
HttpAsyncClient $httpAsyncClient,
3736
RequestInterface $request,
3837
Promise $promise,
@@ -47,7 +46,7 @@ function it_emulates_a_successful_request(
4746
$this->sendRequest($request)->shouldReturn($response);
4847
}
4948

50-
function it_emulates_a_failed_request(HttpAsyncClient $httpAsyncClient, RequestInterface $request, Promise $promise)
49+
public function it_emulates_a_failed_request(HttpAsyncClient $httpAsyncClient, RequestInterface $request, Promise $promise)
5150
{
5251
$promise->wait()->shouldBeCalled();
5352
$promise->getState()->willReturn(Promise::REJECTED);
@@ -58,7 +57,7 @@ function it_emulates_a_failed_request(HttpAsyncClient $httpAsyncClient, RequestI
5857
$this->shouldThrow('Http\Client\Exception')->duringSendRequest($request);
5958
}
6059

61-
function it_decorates_the_underlying_client(
60+
public function it_decorates_the_underlying_client(
6261
HttpAsyncClient $httpAsyncClient,
6362
RequestInterface $request,
6463
Promise $promise

spec/Exception/BatchExceptionSpec.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,32 @@
33
namespace spec\Http\Client\Common\Exception;
44

55
use Http\Client\Common\BatchResult;
6-
use Http\Client\Exception;
76
use PhpSpec\ObjectBehavior;
87

98
class BatchExceptionSpec extends ObjectBehavior
109
{
11-
function let()
10+
public function let()
1211
{
1312
$batchResult = new BatchResult();
1413
$this->beConstructedWith($batchResult);
1514
}
1615

17-
function it_is_initializable()
16+
public function it_is_initializable()
1817
{
1918
$this->shouldHaveType('Http\Client\Common\Exception\BatchException');
2019
}
2120

22-
function it_is_a_runtime_exception()
21+
public function it_is_a_runtime_exception()
2322
{
2423
$this->shouldHaveType('RuntimeException');
2524
}
2625

27-
function it_is_an_exception()
26+
public function it_is_an_exception()
2827
{
2928
$this->shouldImplement('Http\Client\Exception');
3029
}
3130

32-
function it_has_a_batch_result()
31+
public function it_has_a_batch_result()
3332
{
3433
$this->getResult()->shouldHaveType('Http\Client\Common\BatchResult');
3534
}

spec/FlexibleHttpClientSpec.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@
1111

1212
class FlexibleHttpClientSpec extends ObjectBehavior
1313
{
14-
function let(HttpClient $httpClient)
14+
public function let(HttpClient $httpClient)
1515
{
1616
$this->beConstructedWith($httpClient);
1717
}
1818

19-
function it_is_initializable()
19+
public function it_is_initializable()
2020
{
2121
$this->shouldHaveType('Http\Client\Common\FlexibleHttpClient');
2222
}
2323

24-
function it_is_an_http_client()
24+
public function it_is_an_http_client()
2525
{
2626
$this->shouldImplement('Http\Client\HttpClient');
2727
}
2828

29-
function it_is_an_async_http_client()
29+
public function it_is_an_async_http_client()
3030
{
3131
$this->shouldImplement('Http\Client\HttpAsyncClient');
3232
}
3333

34-
function it_throw_exception_if_invalid_client()
34+
public function it_throw_exception_if_invalid_client()
3535
{
3636
$this->beConstructedWith(null);
3737

3838
$this->shouldThrow('\LogicException')->duringInstantiation();
3939
}
4040

41-
function it_emulates_an_async_client(
41+
public function it_emulates_an_async_client(
4242
HttpClient $httpClient,
4343
RequestInterface $syncRequest,
4444
ResponseInterface $syncResponse,
@@ -57,7 +57,7 @@ function it_emulates_an_async_client(
5757
$promise->wait()->shouldReturn($asyncResponse);
5858
}
5959

60-
function it_emulates_a_client(
60+
public function it_emulates_a_client(
6161
HttpAsyncClient $httpAsyncClient,
6262
RequestInterface $asyncRequest,
6363
Promise $promise,
@@ -75,7 +75,7 @@ function it_emulates_a_client(
7575
$this->sendRequest($syncRequest)->shouldReturn($syncResponse);
7676
}
7777

78-
function it_does_not_emulate_a_client($client, RequestInterface $syncRequest, RequestInterface $asyncRequest)
78+
public function it_does_not_emulate_a_client($client, RequestInterface $syncRequest, RequestInterface $asyncRequest)
7979
{
8080
$client->implement('Http\Client\HttpClient');
8181
$client->implement('Http\Client\HttpAsyncClient');

spec/HttpClientPool/LeastUsedClientPoolSpec.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Http\Client\HttpAsyncClient;
77
use Http\Client\HttpClient;
88
use Http\Promise\Promise;
9-
use PhpSpec\Exception\Example\SkippingException;
109
use PhpSpec\ObjectBehavior;
1110
use Prophecy\Argument;
1211
use Psr\Http\Message\RequestInterface;

spec/HttpClientPoolItemSpec.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ public function getState()
156156

157157
public function wait($unwrap = true)
158158
{
159-
if ($this->state === Promise::FULFILLED) {
159+
if (Promise::FULFILLED === $this->state) {
160160
if (!$unwrap) {
161161
return;
162162
}
163163

164164
return $this->response;
165165
}
166166

167-
if ($this->state === Promise::REJECTED) {
167+
if (Promise::REJECTED === $this->state) {
168168
if (!$unwrap) {
169169
return;
170170
}
@@ -175,15 +175,15 @@ public function wait($unwrap = true)
175175
while (count($this->queue) > 0) {
176176
$callbacks = array_shift($this->queue);
177177

178-
if ($this->response !== null) {
178+
if (null !== $this->response) {
179179
try {
180180
$this->response = $callbacks[0]($this->response);
181181
$this->exception = null;
182182
} catch (Exception $exception) {
183183
$this->response = null;
184184
$this->exception = $exception;
185185
}
186-
} elseif ($this->exception !== null) {
186+
} elseif (null !== $this->exception) {
187187
try {
188188
$this->response = $callbacks[1]($this->exception);
189189
$this->exception = null;
@@ -194,15 +194,15 @@ public function wait($unwrap = true)
194194
}
195195
}
196196

197-
if ($this->response !== null) {
197+
if (null !== $this->response) {
198198
$this->state = Promise::FULFILLED;
199199

200200
if ($unwrap) {
201201
return $this->response;
202202
}
203203
}
204204

205-
if ($this->exception !== null) {
205+
if (null !== $this->exception) {
206206
$this->state = Promise::REJECTED;
207207

208208
if ($unwrap) {

spec/HttpClientRouterSpec.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212

1313
class HttpClientRouterSpec extends ObjectBehavior
1414
{
15-
function it_is_initializable()
15+
public function it_is_initializable()
1616
{
1717
$this->shouldHaveType('Http\Client\Common\HttpClientRouter');
1818
}
1919

20-
function it_is_an_http_client()
20+
public function it_is_an_http_client()
2121
{
2222
$this->shouldImplement('Http\Client\HttpClient');
2323
}
2424

25-
function it_is_an_async_http_client()
25+
public function it_is_an_async_http_client()
2626
{
2727
$this->shouldImplement('Http\Client\HttpAsyncClient');
2828
}
2929

30-
function it_send_request(RequestMatcher $matcher, HttpClient $client, RequestInterface $request, ResponseInterface $response)
30+
public function it_send_request(RequestMatcher $matcher, HttpClient $client, RequestInterface $request, ResponseInterface $response)
3131
{
3232
$this->addClient($client, $matcher);
3333
$matcher->matches($request)->willReturn(true);
@@ -36,7 +36,7 @@ function it_send_request(RequestMatcher $matcher, HttpClient $client, RequestInt
3636
$this->sendRequest($request)->shouldReturn($response);
3737
}
3838

39-
function it_send_async_request(RequestMatcher $matcher, HttpAsyncClient $client, RequestInterface $request, Promise $promise)
39+
public function it_send_async_request(RequestMatcher $matcher, HttpAsyncClient $client, RequestInterface $request, Promise $promise)
4040
{
4141
$this->addClient($client, $matcher);
4242
$matcher->matches($request)->willReturn(true);
@@ -45,15 +45,15 @@ function it_send_async_request(RequestMatcher $matcher, HttpAsyncClient $client,
4545
$this->sendAsyncRequest($request)->shouldReturn($promise);
4646
}
4747

48-
function it_throw_exception_on_send_request(RequestMatcher $matcher, HttpClient $client, RequestInterface $request)
48+
public function it_throw_exception_on_send_request(RequestMatcher $matcher, HttpClient $client, RequestInterface $request)
4949
{
5050
$this->addClient($client, $matcher);
5151
$matcher->matches($request)->willReturn(false);
5252

5353
$this->shouldThrow('Http\Client\Exception\RequestException')->duringSendRequest($request);
5454
}
5555

56-
function it_throw_exception_on_send_async_request(RequestMatcher $matcher, HttpAsyncClient $client, RequestInterface $request)
56+
public function it_throw_exception_on_send_async_request(RequestMatcher $matcher, HttpAsyncClient $client, RequestInterface $request)
5757
{
5858
$this->addClient($client, $matcher);
5959
$matcher->matches($request)->willReturn(false);

0 commit comments

Comments
 (0)