File tree Expand file tree Collapse file tree 5 files changed +13
-13
lines changed Expand file tree Collapse file tree 5 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ It wraps a given `ReadableStreamInterface` and exposes its plain data through
2424the same interface.
2525
2626``` php
27- $stdin = new Stream (STDIN, $loop);
27+ $stdin = new ReadableResourceStream (STDIN, $loop);
2828
2929$stream = new ControlCodeParser($stdin);
3030
Original file line number Diff line number Diff line change 1919 },
2020 "require-dev" : {
2121 "phpunit/phpunit" : " ^5.0 || ^4.8" ,
22- "react/event-loop" : " ^0.4 || ^0.3"
22+ "react/event-loop" : " ^0.4 || ^0.3" ,
23+ "react/stream" : " ^0.6"
2324 }
2425}
Original file line number Diff line number Diff line change 1111// with random colors:
1212// $ phpunit --color=always | php random-colors.php
1313
14- use React \Stream \Stream ;
1514use React \EventLoop \Factory ;
1615use Clue \React \Term \ControlCodeParser ;
16+ use React \Stream \ReadableResourceStream ;
17+ use React \Stream \WritableResourceStream ;
1718
1819require __DIR__ . '/../vendor/autoload.php ' ;
1920
2526}
2627
2728// process control codes from STDIN
28- $ stdin = new Stream (STDIN , $ loop );
29+ $ stdin = new ReadableResourceStream (STDIN , $ loop );
2930$ parser = new ControlCodeParser ($ stdin );
3031
31- $ stdout = new Stream (STDOUT , $ loop );
32- $ stdout ->pause ();
32+ $ stdout = new WritableResourceStream (STDOUT , $ loop );
3333
3434// pass all c0 codes through to output
3535$ parser ->on ('c0 ' , array ($ stdout , 'write ' ));
Original file line number Diff line number Diff line change 88// codes like this:
99// $ phpunit --color=always | php remove-codes.php
1010
11- use React \Stream \Stream ;
1211use React \EventLoop \Factory ;
1312use Clue \React \Term \ControlCodeParser ;
13+ use React \Stream \ReadableResourceStream ;
14+ use React \Stream \WritableResourceStream ;
1415
1516require __DIR__ . '/../vendor/autoload.php ' ;
1617
2223}
2324
2425// process control codes from STDIN
25- $ stdin = new Stream (STDIN , $ loop );
26+ $ stdin = new ReadableResourceStream (STDIN , $ loop );
2627$ parser = new ControlCodeParser ($ stdin );
2728
28- $ stdout = new Stream (STDOUT , $ loop );
29- $ stdout ->pause ();
30-
3129// pipe data from STDIN to STDOUT without any codes
30+ $ stdout = new WritableResourceStream (STDOUT , $ loop );
3231$ parser ->pipe ($ stdout );
3332
3433// only forward \r, \n and \t
Original file line number Diff line number Diff line change 99// codes like this:
1010// $ phpunit --color=always | php stdin-codes.php
1111
12- use React \Stream \Stream ;
1312use React \EventLoop \Factory ;
1413use Clue \React \Term \ControlCodeParser ;
14+ use React \Stream \ReadableResourceStream ;
1515
1616require __DIR__ . '/../vendor/autoload.php ' ;
1717
2323}
2424
2525// process control codes from STDIN
26- $ stdin = new Stream (STDIN , $ loop );
26+ $ stdin = new ReadableResourceStream (STDIN , $ loop );
2727$ parser = new ControlCodeParser ($ stdin );
2828
2929$ decoder = function ($ code ) {
You can’t perform that action at this time.
0 commit comments