25 parent::__construct(
$body);
35 if (!$this->body->isReadable() ||
36 (!$this->body->isSeekable() && $this->body->isConsumed())
41 $originalPos = $this->body->ftell();
42 $this->body->seek($this->offset);
44 while (!$this->
feof()) {
45 $data .= $this->
read(1048576);
47 $this->body->seek($originalPos);
49 return (
string) $data ?:
'';
54 return $this->body->isConsumed() ||
64 $length = $this->body->getContentLength();
66 return $length ===
false
68 : min($this->limit, min($length, $this->offset + $this->limit) - $this->offset);
77 return $whence === SEEK_SET
78 ? $this->body->seek(max($this->offset, min($this->offset + $this->limit,
$offset)))
111 public function read($length)
114 $remaining = ($this->offset +
$this->limit) - $this->body->ftell();
115 if ($remaining > 0) {
117 return $this->body->read(min($remaining, $length));