| @@ 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} |
|
| @@ 174-185 (lines=12) @@ | ||
| 171 | /** |
|
| 172 | * {@inheritdoc} |
|
| 173 | */ |
|
| 174 | public function read($length, $blocking = true) |
|
| 175 | { |
|
| 176 | if ($this->peek($length, $blocking) === null) { |
|
| 177 | return null; |
|
| 178 | } |
|
| 179 | ||
| 180 | $data = substr($this->buffer, 0, $length); |
|
| 181 | ||
| 182 | $this->buffer = substr($this->buffer, $length, strlen($this->buffer) - $length); |
|
| 183 | ||
| 184 | return $data; |
|
| 185 | } |
|
| 186 | ||
| 187 | /** |
|
| 188 | * @param int $length |
|