Code Duplication    Length = 11-11 lines in 2 locations

src/Messages/Bodies/StreamedBinary.php 1 location

@@ 35-45 (lines=11) @@
32
        $offset = 0;
33
        $playhead = 0;
34
35
        while($offset < $length)
36
        {
37
            $content = substr($wholeContent, $offset, $this->chunkSize->toBytes());
38
            $playhead++;
39
40
            $chunk = new Chunk($playhead, $offset, $content, $this->metadata);
41
            yield $chunk;
42
43
            $offset += $chunk->size();
44
            unset($chunk, $content);
45
        }
46
    }
47
48
    public function isChunked()

src/Messages/Bodies/StreamedFile.php 1 location

@@ 70-80 (lines=11) @@
67
68
        $stream = fopen($this->filepath, 'r');
69
70
        while(! feof($stream))
71
        {
72
            $content = fread($stream, $this->chunkSize->toBytes());
73
            $playhead++;
74
75
            $chunk = new Chunk($playhead, $offset, $content, $this->metadata);
76
            yield $chunk;
77
78
            $offset += $chunk->size();
79
            unset($chunk, $content);
80
        }
81
82
        fclose($stream);
83
    }