@@ -20,42 +20,42 @@ public function __construct($timeout = 1000000)
20
20
21
21
public function addReadStream ($ stream , $ listener )
22
22
{
23
- $ streamID = (int ) $ stream ;
23
+ $ id = (int ) $ stream ;
24
24
25
- if (!isset ($ this ->readStreams [$ streamID ])) {
26
- $ this ->readStreams [$ streamID ] = $ stream ;
27
- $ this ->readListeners [$ streamID ] = array ();
25
+ if (!isset ($ this ->readStreams [$ id ])) {
26
+ $ this ->readStreams [$ id ] = $ stream ;
27
+ $ this ->readListeners [$ id ] = array ();
28
28
}
29
29
30
- $ this ->readListeners [$ streamID ][] = $ listener ;
30
+ $ this ->readListeners [$ id ][] = $ listener ;
31
31
}
32
32
33
33
public function addWriteStream ($ stream , $ listener )
34
34
{
35
- $ streamID = (int ) $ stream ;
35
+ $ id = (int ) $ stream ;
36
36
37
- if (!isset ($ this ->writeStreams [$ streamID ])) {
38
- $ this ->writeStreams [$ streamID ] = $ stream ;
39
- $ this ->writeListeners [$ streamID ] = array ();
37
+ if (!isset ($ this ->writeStreams [$ id ])) {
38
+ $ this ->writeStreams [$ id ] = $ stream ;
39
+ $ this ->writeListeners [$ id ] = array ();
40
40
}
41
41
42
- $ this ->writeListeners [$ streamID ][] = $ listener ;
42
+ $ this ->writeListeners [$ id ][] = $ listener ;
43
43
}
44
44
45
45
public function removeReadStream ($ stream )
46
46
{
47
- $ streamID = (int ) $ stream ;
47
+ $ id = (int ) $ stream ;
48
48
49
- unset($ this ->readStreams [$ streamID ]);
50
- unset($ this ->readListeners [$ streamID ]);
49
+ unset($ this ->readStreams [$ id ]);
50
+ unset($ this ->readListeners [$ id ]);
51
51
}
52
52
53
53
public function removeWriteStream ($ stream )
54
54
{
55
- $ streamID = (int ) $ stream ;
55
+ $ id = (int ) $ stream ;
56
56
57
- unset($ this ->writeStreams [$ streamID ]);
58
- unset($ this ->writeListeners [$ streamID ]);
57
+ unset($ this ->writeStreams [$ id ]);
58
+ unset($ this ->writeListeners [$ id ]);
59
59
}
60
60
61
61
public function removeStream ($ stream )
@@ -69,7 +69,7 @@ public function tick()
69
69
$ read = $ this ->readStreams ?: null ;
70
70
$ write = $ this ->writeStreams ?: null ;
71
71
72
- if (( $ ready = @stream_select ($ read , $ write , $ except = null , 0 , $ this ->timeout ) ) > 0 ) {
72
+ if (@stream_select ($ read , $ write , $ except = null , 0 , $ this ->timeout ) > 0 ) {
73
73
if ($ read ) {
74
74
foreach ($ read as $ stream ) {
75
75
foreach ($ this ->readListeners [(int ) $ stream ] as $ listener ) {
0 commit comments