| @@ 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} |
|
| @@ 221-232 (lines=12) @@ | ||
| 218 | /** |
|
| 219 | * {@inheritdoc} |
|
| 220 | */ |
|
| 221 | public function read($length, $blocking = true) |
|
| 222 | { |
|
| 223 | if (!$this->peek($length, $blocking)) { |
|
| 224 | return null; |
|
| 225 | } |
|
| 226 | ||
| 227 | $data = substr($this->buffer, 0, $length); |
|
| 228 | ||
| 229 | $this->buffer = substr($this->buffer, $length, strlen($this->buffer) - $length); |
|
| 230 | ||
| 231 | return $data; |
|
| 232 | } |
|
| 233 | ||
| 234 | /** |
|
| 235 | * @param int $length |
|