You are here

public function LimitStream::getSize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/LimitStream.php \GuzzleHttp\Psr7\LimitStream::getSize()

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);
  }
}