Skip to content

Commit a81a87b

Browse files
authored
Merge pull request #7 from clue-labs/docs
Minor documentation improvements
2 parents d5ff9b2 + 250cd1d commit a81a87b

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ all resources on your side.
1313
Instead, you can use this library to stream your arbitrarily large input list
1414
as individual records to a non-blocking (async) transformation handler. It uses
1515
[ReactPHP](https://reactphp.org) to enable you to concurrently process multiple
16-
records at once. It allows you to control the concurrency, so that by allowing
16+
records at once. You can control the concurrency limit, so that by allowing
1717
it to process 10 operations at the same time, you can thus process this large
1818
input list around 10 times faster and at the same time you're no longer limited
19-
in how many records this list may contain (think processing millions of records).
19+
how many records this list may contain (think processing millions of records).
2020
This library provides a simple API that is easy to use in order to manage any
2121
kind of async operation without having to mess with most of the low-level details.
2222
You can use this to throttle multiple HTTP requests, database queries or pretty
@@ -179,10 +179,12 @@ $transformer = new Transformer(10, array($browser, 'get'));
179179

180180
This library works under the assumption that you want to concurrently handle
181181
async operations that use a [Promise](https://github.com/reactphp/promise)-based API.
182+
You can use this to concurrently run multiple HTTP requests, database queries
183+
or pretty much any API that already uses Promises.
182184

183185
The demonstration purposes, the examples in this documentation use the async
184-
HTTP client [clue/reactphp-buzz](https://github.com/clue/reactphp-buzz), but you
185-
may use any Promise-based API with this project. Its API can be used like this:
186+
HTTP client [clue/reactphp-buzz](https://github.com/clue/reactphp-buzz).
187+
Its API can be used like this:
186188

187189
```php
188190
$loop = React\EventLoop\Factory::create();
@@ -329,17 +331,17 @@ $transformer->on('data', function (ResponseInterface $response) {
329331
$transformer->write('http://example.com/');
330332
```
331333

332-
This callable receives a single data argument as passed to the writable side
334+
This handler receives a single data argument as passed to the writable side
333335
and must return a promise. A succesful fulfillment value will be forwarded to
334336
the readable end of the stream, while an unsuccessful rejection value will
335-
emit an `error` event, try to `cancel()` all pending operations and and
337+
emit an `error` event, try to `cancel()` all pending operations and then
336338
`close()` the stream.
337339

338340
Note that this class makes no assumptions about any data types. Whatever is
339341
written to it, will be processed by the transformation handler. Whatever the
340342
transformation handler yields will be forwarded to its readable end.
341343

342-
The `end(mixed $data = null): bool` method can be used to
344+
The `end(mixed $data = null): void` method can be used to
343345
soft-close the stream once all transformation handlers are completed.
344346
It will close the writable side, wait for all outstanding transformation
345347
handlers to complete and then emit an `end` event and then `close()` the stream.

src/Transformer.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
*
3434
* This library works under the assumption that you want to concurrently handle
3535
* async operations that use a [Promise](https://github.com/reactphp/promise)-based API.
36+
* You can use this to concurrently run multiple HTTP requests, database queries
37+
* or pretty much any API that already uses Promises.
3638
*
3739
* The demonstration purposes, the examples in this documentation use the async
38-
* HTTP client [clue/reactphp-buzz](https://github.com/clue/reactphp-buzz), but you
39-
* may use any Promise-based API with this project. Its API can be used like this:
40+
* HTTP client [clue/reactphp-buzz](https://github.com/clue/reactphp-buzz).
41+
* Its API can be used like this:
4042
*
4143
* ```php
4244
* $loop = React\EventLoop\Factory::create();
@@ -183,17 +185,17 @@
183185
* $transformer->write('http://example.com/');
184186
* ```
185187
*
186-
* This callable receives a single data argument as passed to the writable side
188+
* The handler receives a single data argument as passed to the writable side
187189
* and must return a promise. A succesful fulfillment value will be forwarded to
188190
* the readable end of the stream, while an unsuccessful rejection value will
189-
* emit an `error` event, try to `cancel()` all pending operations and and
191+
* emit an `error` event, try to `cancel()` all pending operations and then
190192
* `close()` the stream.
191193
*
192194
* Note that this class makes no assumptions about any data types. Whatever is
193195
* written to it, will be processed by the transformation handler. Whatever the
194196
* transformation handler yields will be forwarded to its readable end.
195197
*
196-
* The `end(mixed $data = null): bool` method can be used to
198+
* The `end(mixed $data = null): void` method can be used to
197199
* soft-close the stream once all transformation handlers are completed.
198200
* It will close the writable side, wait for all outstanding transformation
199201
* handlers to complete and then emit an `end` event and then `close()` the stream.

0 commit comments

Comments
 (0)