public function Stream::getSize in Lockr 7.3
Get the size of the stream if known.
Return value
int|null Returns the size in bytes if known, or null if unknown.
Overrides StreamInterface::getSize
File
- vendor/
guzzlehttp/ psr7/ src/ Stream.php, line 130
Class
- Stream
- PHP stream implementation.
Namespace
GuzzleHttp\Psr7Code
public function getSize() {
if ($this->size !== null) {
return $this->size;
}
if (!isset($this->stream)) {
return null;
}
// Clear the stat cache if the stream has a URI
if ($this->uri) {
clearstatcache(true, $this->uri);
}
$stats = fstat($this->stream);
if (isset($stats['size'])) {
$this->size = $stats['size'];
return $this->size;
}
return null;
}