1 | <?php |
||
16 | class Stream implements DuplexStreamInterface |
||
17 | { |
||
18 | use EventEmitterTrait; |
||
19 | use UtilsTrait; |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | protected $bufferSize; |
||
25 | |||
26 | /** |
||
27 | * @var resource |
||
28 | */ |
||
29 | protected $stream; |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $readable; |
||
35 | |||
36 | /** |
||
37 | * @var bool |
||
38 | */ |
||
39 | protected $writable; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | protected $closing; |
||
45 | |||
46 | /** |
||
47 | * @var EventLoopInterface |
||
48 | */ |
||
49 | protected $loop; |
||
50 | |||
51 | /** |
||
52 | * @var Buffer |
||
53 | */ |
||
54 | protected $buffer; |
||
55 | |||
56 | /** |
||
57 | * Stream constructor. |
||
58 | * |
||
59 | * @param resource $stream |
||
60 | * @param EventLoopInterface $loop |
||
61 | * @param int $bufferSize |
||
62 | */ |
||
63 | 7 | public function __construct($stream, EventLoopInterface $loop, int $bufferSize = 4096) |
|
93 | |||
94 | /** |
||
95 | * @inheritdoc |
||
96 | */ |
||
97 | 6 | public function isReadable() : bool |
|
101 | |||
102 | /** |
||
103 | * @inheritdoc |
||
104 | */ |
||
105 | 3 | public function isWritable() : bool |
|
109 | |||
110 | /** |
||
111 | * @inheritdoc |
||
112 | */ |
||
113 | public function pause() : self |
||
119 | |||
120 | /** |
||
121 | * @inheritdoc |
||
122 | */ |
||
123 | 6 | public function resume() : self |
|
131 | |||
132 | /** |
||
133 | * @inheritdoc |
||
134 | */ |
||
135 | 1 | public function write($data) |
|
143 | |||
144 | /** |
||
145 | * @inheritdoc |
||
146 | */ |
||
147 | 3 | public function close() : self |
|
168 | |||
169 | /** |
||
170 | * @inheritdoc |
||
171 | */ |
||
172 | 2 | public function end($data = null) : self |
|
188 | |||
189 | /** |
||
190 | * @inheritdoc |
||
191 | */ |
||
192 | public function pipe(WritableStreamInterface $destination, array $options = []) |
||
198 | |||
199 | /** |
||
200 | * @param resource $stream |
||
201 | */ |
||
202 | 2 | public function handleData($stream) |
|
212 | |||
213 | 3 | public function handleClose() |
|
219 | |||
220 | /** |
||
221 | * @return Buffer |
||
222 | */ |
||
223 | 1 | public function getBuffer() |
|
227 | |||
228 | /** |
||
229 | * @return int |
||
230 | */ |
||
231 | public function getBufferSize() : int |
||
235 | |||
236 | /** |
||
237 | * @param int $bufferSize |
||
238 | * |
||
239 | * @return $this |
||
240 | */ |
||
241 | public function setBufferSize(int $bufferSize) : self |
||
247 | } |
||
248 |