| @@ 208-221 (lines=14) @@ | ||
| 205 | /** |
|
| 206 | * {@inheritdoc} |
|
| 207 | */ |
|
| 208 | public function read($length) |
|
| 209 | { |
|
| 210 | if (!$this->isReadable()) { |
|
| 211 | throw new \RuntimeException('Stream is not readable'); |
|
| 212 | } |
|
| 213 | ||
| 214 | $result = fread($this->resource, $length); |
|
| 215 | ||
| 216 | if ($result === false) { |
|
| 217 | throw new \RuntimeException('Error while reading the stream'); |
|
| 218 | } |
|
| 219 | ||
| 220 | return $result; |
|
| 221 | } |
|
| 222 | ||
| 223 | /** |
|
| 224 | * {@inheritdoc} |
|
| @@ 226-239 (lines=14) @@ | ||
| 223 | /** |
|
| 224 | * {@inheritdoc} |
|
| 225 | */ |
|
| 226 | public function getContents() |
|
| 227 | { |
|
| 228 | if (!$this->isReadable()) { |
|
| 229 | throw new \RuntimeException('Stream is not readable'); |
|
| 230 | } |
|
| 231 | ||
| 232 | $result = stream_get_contents($this->resource); |
|
| 233 | ||
| 234 | if ($result === false) { |
|
| 235 | throw new \RuntimeException('Error while reading the stream'); |
|
| 236 | } |
|
| 237 | ||
| 238 | return $result; |
|
| 239 | } |
|
| 240 | ||
| 241 | /** |
|
| 242 | * {@inheritdoc} |
|