You are here

public function LimitStream::getSize in Lockr 7.3

Returns the size of the limited subset of data

Overrides StreamDecoratorTrait::getSize

File

vendor/guzzlehttp/psr7/src/LimitStream.php, line 56

Class

LimitStream
Decorator used to return only a subset of a stream

Namespace

GuzzleHttp\Psr7

Code

public function getSize() {
  if (null === ($length = $this->stream
    ->getSize())) {
    return null;
  }
  elseif ($this->limit == -1) {
    return $length - $this->offset;
  }
  else {
    return min($this->limit, $length - $this->offset);
  }
}