@@ -13,10 +13,10 @@ all resources on your side.
1313Instead, you can use this library to stream your arbitrarily large input list
1414as 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
1717it to process 10 operations at the same time, you can thus process this large
1818input 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).
2020This library provides a simple API that is easy to use in order to manage any
2121kind of async operation without having to mess with most of the low-level details.
2222You can use this to throttle multiple HTTP requests, database queries or pretty
@@ -179,10 +179,12 @@ $transformer = new Transformer(10, array($browser, 'get'));
179179
180180This library works under the assumption that you want to concurrently handle
181181async 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
183185The 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
333335and must return a promise. A succesful fulfillment value will be forwarded to
334336the 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
338340Note that this class makes no assumptions about any data types. Whatever is
339341written to it, will be processed by the transformation handler. Whatever the
340342transformation 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
343345soft-close the stream once all transformation handlers are completed.
344346It will close the writable side, wait for all outstanding transformation
345347handlers to complete and then emit an ` end ` event and then ` close() ` the stream.
0 commit comments