Code Duplication    Length = 15-15 lines in 2 locations

src/Stream.php 2 locations

@@ 237-251 (lines=15) @@
234
    /**
235
     * {@inheritdoc}
236
     */
237
    public function read($length = 1)
238
    {
239
        $resource = $this->getResource();
240
241
        if (!$this->isReadable()) {
242
            throw new Exception\BadMethodCallException('Operation not supported');
243
        }
244
245
        $data = @fread($resource, $length);
246
        if (false === $data) {
247
            throw new Exception\IOException('Unexpected result of operation');
248
        }
249
250
        return $data;
251
    }
252
253
    /**
254
     * {@inheritdoc}
@@ 256-270 (lines=15) @@
253
    /**
254
     * {@inheritdoc}
255
     */
256
    public function write($data)
257
    {
258
        $resource = $this->getResource();
259
260
        if (!$this->isWritable()) {
261
            throw new Exception\BadMethodCallException('Operation not supported');
262
        }
263
264
        $length = @fwrite($resource, $data);
265
        if (false === $length) {
266
            throw new Exception\IOException('Unexpected result of operation');
267
        }
268
269
        return $length;
270
    }
271
272
    /**
273
     * {@inheritdoc}