Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Stream.php

function Stream::getSize

Same name in this branch
  1. 11.1.x vendor/symfony/http-foundation/File/Stream.php \Symfony\Component\HttpFoundation\File\Stream::getSize()

Overrides StreamInterface::getSize

File

vendor/guzzlehttp/psr7/src/Stream.php, line 132

Class

Stream
PHP stream implementation.

Namespace

GuzzleHttp\Psr7

Code

public function getSize() : ?int {
    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 (is_array($stats) && isset($stats['size'])) {
        $this->size = $stats['size'];
        return $this->size;
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal