@@ 46-56 (lines=11) @@ | ||
43 | /** |
|
44 | * {@inheritdoc} |
|
45 | */ |
|
46 | public function read($length, $blocking = true) |
|
47 | { |
|
48 | if (strlen($this->readBuffer) >= $length) { |
|
49 | $data = substr($this->readBuffer, 0, $length); |
|
50 | $this->readBuffer = substr($this->readBuffer, $length, strlen($this->readBuffer) - $length); |
|
51 | ||
52 | return $data; |
|
53 | } |
|
54 | ||
55 | return null; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * {@inheritdoc} |
@@ 191-202 (lines=12) @@ | ||
188 | /** |
|
189 | * {@inheritdoc} |
|
190 | */ |
|
191 | public function read($length, $blocking = true) |
|
192 | { |
|
193 | if ($this->peek($length, $blocking) === null) { |
|
194 | return null; |
|
195 | } |
|
196 | ||
197 | $data = substr($this->buffer, 0, $length); |
|
198 | ||
199 | $this->buffer = substr($this->buffer, $length, strlen($this->buffer) - $length); |
|
200 | ||
201 | return $data; |
|
202 | } |
|
203 | ||
204 | /** |
|
205 | * @param int $length |