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

@@ 60-70 (lines=11) @@
57
58
        $stream = fopen($this->filepath, 'r');
59
60
        while(! feof($stream))
61
        {
62
            $content = fread($stream, $this->chunkSize->toBytes());
63
            $playhead++;
64
65
            $chunk = new Chunk($playhead, $offset, $content, $this->metadata);
66
            yield $chunk;
67
68
            $offset += $chunk->size();
69
            unset($chunk, $content);
70
        }
71
72
        fclose($stream);
73
    }