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

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