Skip to content

Commit ca7fdec

Browse files
authored
Merge pull request #375 from clue-labs/docs
Improve documentation and use fully-qualified class names throughout the documentation
2 parents 271dd95 + 552dbdd commit ca7fdec

14 files changed

Lines changed: 203 additions & 214 deletions

README.md

Lines changed: 146 additions & 153 deletions
Large diffs are not rendered by default.

src/Browser.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
namespace React\Http;
44

5+
use Psr\Http\Message\ResponseInterface;
6+
use React\EventLoop\LoopInterface;
7+
use React\Http\Io\MessageFactory;
58
use React\Http\Io\Sender;
69
use React\Http\Io\Transaction;
7-
use React\Http\Message\MessageFactory;
8-
use InvalidArgumentException;
9-
use Psr\Http\Message\RequestInterface;
10-
use Psr\Http\Message\UriInterface;
11-
use React\EventLoop\LoopInterface;
1210
use React\Promise\PromiseInterface;
1311
use React\Socket\ConnectorInterface;
1412
use React\Stream\ReadableStreamInterface;
13+
use InvalidArgumentException;
1514

1615
/**
1716
* @final This class is final and shouldn't be extended as it is likely to be marked final in a future relase.
@@ -719,7 +718,7 @@ private function withOptions(array $options)
719718

720719
/**
721720
* @param string $method
722-
* @param string|UriInterface $url
721+
* @param string $url
723722
* @param array $headers
724723
* @param string|ReadableStreamInterface $contents
725724
* @return PromiseInterface<ResponseInterface,Exception>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace React\Http\Message;
3+
namespace React\Http\Io;
44

55
use Psr\Http\Message\StreamInterface;
66
use Psr\Http\Message\UriInterface;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace React\Http\Message;
3+
namespace React\Http\Io;
44

55
use Evenement\EventEmitter;
66
use Psr\Http\Message\StreamInterface;

src/Io/Sender.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace React\Http\Io;
44

5-
use React\Http\Message\MessageFactory;
65
use Psr\Http\Message\RequestInterface;
76
use React\EventLoop\LoopInterface;
87
use React\Http\Client\Client as HttpClient;

src/Io/Transaction.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
namespace React\Http\Io;
44

5-
use React\Http\Message\ResponseException;
6-
use React\Http\Message\MessageFactory;
75
use Psr\Http\Message\RequestInterface;
86
use Psr\Http\Message\ResponseInterface;
97
use Psr\Http\Message\UriInterface;
108
use React\EventLoop\LoopInterface;
9+
use React\Http\Message\ResponseException;
1110
use React\Promise\Deferred;
1211
use React\Promise\PromiseInterface;
1312
use React\Stream\ReadableStreamInterface;

src/Message/Response.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
* which in turn extends the
2626
* [PSR-7 `MessageInterface`](https://www.php-fig.org/psr/psr-7/#31-psrhttpmessagemessageinterface).
2727
*
28-
* > Internally, this class extends the underlying `\RingCentral\Psr7\Response`
29-
* class. The only difference is that this class will accept implemenations
30-
* of ReactPHPs `ReadableStreamInterface` for the `$body` argument. This base
31-
* class is considered an implementation detail that may change in the future.
28+
* > Internally, this implementation builds on top of an existing incoming
29+
* response message and only adds required streaming support. This base class is
30+
* considered an implementation detail that may change in the future.
3231
*
3332
* @see \Psr\Http\Message\ResponseInterface
3433
*/

src/Message/ResponseException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Psr\Http\Message\ResponseInterface;
77

88
/**
9-
* The `ResponseException` is an `Exception` sub-class that will be used to reject
9+
* The `React\Http\Message\ResponseException` is an `Exception` sub-class that will be used to reject
1010
* a request promise if the remote server returns a non-success status code
1111
* (anything but 2xx or 3xx).
1212
* You can control this behavior via the [`withRejectErrorResponse()` method](#withrejecterrorresponse).
@@ -32,7 +32,7 @@ public function __construct(ResponseInterface $response, $message = null, $code
3232
}
3333

3434
/**
35-
* Access its underlying [`ResponseInterface`](#responseinterface) object.
35+
* Access its underlying response object.
3636
*
3737
* @return ResponseInterface
3838
*/

src/Middleware/LimitConcurrentRequestsMiddleware.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
* than 10 handlers will be invoked at once:
3030
*
3131
* ```php
32-
* $server = new Server(
32+
* $server = new React\Http\Server(
3333
* $loop,
34-
* new StreamingRequestMiddleware(),
35-
* new LimitConcurrentRequestsMiddleware(10),
34+
* new React\Http\Middleware\StreamingRequestMiddleware(),
35+
* new React\Http\Middleware\LimitConcurrentRequestsMiddleware(10),
3636
* $handler
3737
* );
3838
* ```
@@ -42,12 +42,12 @@
4242
* to limit the total number of requests that can be buffered at once:
4343
*
4444
* ```php
45-
* $server = new Server(
45+
* $server = new React\Http\Server(
4646
* $loop,
47-
* new StreamingRequestMiddleware(),
48-
* new LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
49-
* new RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
50-
* new RequestBodyParserMiddleware(),
47+
* new React\Http\Middleware\StreamingRequestMiddleware(),
48+
* new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
49+
* new React\Http\Middleware\RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
50+
* new React\Http\Middleware\RequestBodyParserMiddleware(),
5151
* $handler
5252
* );
5353
* ```
@@ -57,13 +57,13 @@
5757
* processes one request after another without any concurrency:
5858
*
5959
* ```php
60-
* $server = new Server(
60+
* $server = new React\Http\Server(
6161
* $loop,
62-
* new StreamingRequestMiddleware(),
63-
* new LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
64-
* new RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
65-
* new RequestBodyParserMiddleware(),
66-
* new LimitConcurrentRequestsMiddleware(1), // only execute 1 handler (no concurrency)
62+
* new React\Http\Middleware\StreamingRequestMiddleware(),
63+
* new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
64+
* new React\Http\Middleware\RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
65+
* new React\Http\Middleware\RequestBodyParserMiddleware(),
66+
* new React\Http\Middleware\LimitConcurrentRequestsMiddleware(1), // only execute 1 handler (no concurrency)
6767
* $handler
6868
* );
6969
* ```

src/Server.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use React\Socket\ServerInterface;
1515

1616
/**
17-
* The `Server` class is responsible for handling incoming connections and then
17+
* The `React\Http\Server` class is responsible for handling incoming connections and then
1818
* processing each incoming HTTP request.
1919
*
2020
* When a complete HTTP request has been received, it will invoke the given
@@ -292,9 +292,9 @@ public function __construct(LoopInterface $loop)
292292
*
293293
* @param ServerInterface $socket
294294
*/
295-
public function listen(ServerInterface $server)
295+
public function listen(ServerInterface $socket)
296296
{
297-
$this->streamingServer->listen($server);
297+
$this->streamingServer->listen($socket);
298298
}
299299

300300
/**

0 commit comments

Comments
 (0)