Code Duplication    Length = 20-20 lines in 2 locations

src/Stream/Stream.php 1 location

@@ 325-344 (lines=20) @@
322
    /**
323
     *
324
     */
325
    private function writeEnd()
326
    {
327
        do
328
        {
329
            try
330
            {
331
                $sent = @fwrite($this->resource, $this->buffer->peek());
332
                $this->buffer->remove($sent);
333
            }
334
            catch (Error $ex)
335
            {
336
                $sent = 0;
337
            }
338
            catch (Exception $ex)
339
            {
340
                $sent = 0;
341
            }
342
        }
343
        while (is_resource($this->resource) && $sent > 0 && !$this->buffer->isEmpty());
344
    }
345
}
346

src/Stream/StreamWriter.php 1 location

@@ 234-253 (lines=20) @@
231
    /**
232
     *
233
     */
234
    private function writeEnd()
235
    {
236
        do
237
        {
238
            try
239
            {
240
                $sent = @fwrite($this->resource, $this->buffer->peek());
241
                $this->buffer->remove($sent);
242
            }
243
            catch (Error $ex)
244
            {
245
                $sent = 0;
246
            }
247
            catch (Exception $ex)
248
            {
249
                $sent = 0;
250
            }
251
        }
252
        while (is_resource($this->resource) && $sent > 0 && !$this->buffer->isEmpty());
253
    }
254
}
255