public function seek($offset,
$whence = SEEK_SET
): void
{ if ($whence === SEEK_SET
) { $byte =
$offset;
} elseif ($whence === SEEK_CUR
) { $byte =
$offset +
$this->
tell();
} elseif ($whence === SEEK_END
) { $size =
$this->remoteStream->
getSize();
if ($size === null
) { $size =
$this->
cacheEntireStream();
} $byte =
$size +
$offset;
} else { throw new \
InvalidArgumentException('Invalid whence'
);
} $diff =
$byte -
$this->stream->
getSize();
if ($diff > 0
) { // Read the remoteStream until we have read in at least the amount
// of bytes requested, or we reach the end of the file.