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
24
24
the same interface.
25
25
26
26
``` php
27
- $stdin = new Stream (STDIN, $loop);
27
+ $stdin = new ReadableResourceStream (STDIN, $loop);
28
28
29
29
$stream = new ControlCodeParser($stdin);
30
30
Original file line number Diff line number Diff line change 19
19
},
20
20
"require-dev" : {
21
21
"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"
23
24
}
24
25
}
Original file line number Diff line number Diff line change 11
11
// with random colors:
12
12
// $ phpunit --color=always | php random-colors.php
13
13
14
- use React \Stream \Stream ;
15
14
use React \EventLoop \Factory ;
16
15
use Clue \React \Term \ControlCodeParser ;
16
+ use React \Stream \ReadableResourceStream ;
17
+ use React \Stream \WritableResourceStream ;
17
18
18
19
require __DIR__ . '/../vendor/autoload.php ' ;
19
20
25
26
}
26
27
27
28
// process control codes from STDIN
28
- $ stdin = new Stream (STDIN , $ loop );
29
+ $ stdin = new ReadableResourceStream (STDIN , $ loop );
29
30
$ parser = new ControlCodeParser ($ stdin );
30
31
31
- $ stdout = new Stream (STDOUT , $ loop );
32
- $ stdout ->pause ();
32
+ $ stdout = new WritableResourceStream (STDOUT , $ loop );
33
33
34
34
// pass all c0 codes through to output
35
35
$ parser ->on ('c0 ' , array ($ stdout , 'write ' ));
Original file line number Diff line number Diff line change 8
8
// codes like this:
9
9
// $ phpunit --color=always | php remove-codes.php
10
10
11
- use React \Stream \Stream ;
12
11
use React \EventLoop \Factory ;
13
12
use Clue \React \Term \ControlCodeParser ;
13
+ use React \Stream \ReadableResourceStream ;
14
+ use React \Stream \WritableResourceStream ;
14
15
15
16
require __DIR__ . '/../vendor/autoload.php ' ;
16
17
22
23
}
23
24
24
25
// process control codes from STDIN
25
- $ stdin = new Stream (STDIN , $ loop );
26
+ $ stdin = new ReadableResourceStream (STDIN , $ loop );
26
27
$ parser = new ControlCodeParser ($ stdin );
27
28
28
- $ stdout = new Stream (STDOUT , $ loop );
29
- $ stdout ->pause ();
30
-
31
29
// pipe data from STDIN to STDOUT without any codes
30
+ $ stdout = new WritableResourceStream (STDOUT , $ loop );
32
31
$ parser ->pipe ($ stdout );
33
32
34
33
// only forward \r, \n and \t
Original file line number Diff line number Diff line change 9
9
// codes like this:
10
10
// $ phpunit --color=always | php stdin-codes.php
11
11
12
- use React \Stream \Stream ;
13
12
use React \EventLoop \Factory ;
14
13
use Clue \React \Term \ControlCodeParser ;
14
+ use React \Stream \ReadableResourceStream ;
15
15
16
16
require __DIR__ . '/../vendor/autoload.php ' ;
17
17
23
23
}
24
24
25
25
// process control codes from STDIN
26
- $ stdin = new Stream (STDIN , $ loop );
26
+ $ stdin = new ReadableResourceStream (STDIN , $ loop );
27
27
$ parser = new ControlCodeParser ($ stdin );
28
28
29
29
$ decoder = function ($ code ) {
You can’t perform that action at this time.
0 commit comments